Fix 1993/vanb for clang

The problem was the usual suspect where any arg other than the first was
not a char **. Instead O5 is no longer defined to be main() and it is
its own function now which main() calls. The third arg starts out as a
global variable that is passed into the function (which is recursive).

Now the output is correct.
This commit is contained in:
Cody Boone Ferguson committed 2023-03-23 16:04:38 -07:00
1 parent 7d3ef55280
commit 8d9955f6b3
3 files changed
+18 -10

No files matched your search

+1 -2
View File
@@ -93,7 +93,7 @@ ARCH=
# Defines that are needed to compile # Defines that are needed to compile
# #
#CDEFINE= #CDEFINE=
CDEFINE= -DO5=main CDEFINE=
# Include files that are needed to compile # Include files that are needed to compile
# #
@@ -182,7 +182,6 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
@echo "NOTE: This entry might not compile when using modern compilers."
${CC} ${CFLAGS} $< -o $@ ${LIBS} ${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable # alternative executable
+14 -7
View File
@@ -10,21 +10,28 @@
make all make all
NOTE: we could not compile this entry under modern macOS but it will work [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work with
fine under linux. It likely fails to compile under macOS because its gcc is clang. The problem was that the third arg to main() was not a `char **`. Instead
actually just clang which is more strict about the type of the third `O5()` (which was `main()`) is now its own function which main() calls with the
argument of main(). If you have gcc under macOS it might work just as well. right parameters. Thank you Cody for your assistance!
We did not test other systems.
### To run ## To run:
./vanb 'exp' ./vanb 'exp'
where: where:
'exp' an octal expression 'exp' an octal expression
## Judges' comments
## Try:
./vanb 1+1
./vanb 4+4
## Judges' comments:
The octal expression may contain: The octal expression may contain:
+3 -1
View File
@@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
O5(O2,O7,O3)char**O7;{return!(O2+=~01+01)?00:!(O2-=02>01)?printf("\045\157\012" int O3;
int O5(O2, O7, O3)char **O7;{return!(O2+=~01+01)?00:!(O2-=02>01)?printf("\045\157\012"
,O5(012,O7+01,00)):!(O2-=02>>01)?(**O7<=067&&**O7>057?O5(03,O7,*(*O7)++-060+010 ,O5(012,O7+01,00)):!(O2-=02>>01)?(**O7<=067&&**O7>057?O5(03,O7,*(*O7)++-060+010
*O3):O3 ):!(O2 -=-O3- ~O3)? (072>** *O3):O3 ):!(O2 -=-O3- ~O3)? (072>**
O7&&060 <=**O7 ?O5(04 ,O7,012 *O3-060 O7&&060 <=**O7 ?O5(04 ,O7,012 *O3-060
@@ -25,3 +26,4 @@ O5(O2,O7,O3)char**O7;{return!(O2+=~01+01)?00:!(O2-=02>01)?printf("\045\157\012"
,O7,O5(06,O7, 00)):!( O2+=-02/ 02)?(!(* ,O7,O5(06,O7, 00)):!( O2+=-02/ 02)?(!(*
*O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):!(055^**O7)?O5(011,O7,O3-(03+*(*O7 *O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):!(055^**O7)?O5(011,O7,O3-(03+*(*O7
)++,O5(0010,O7,00))):O3):!(O2-=0563&0215)?O5(011,O7,O5(010,O7,00)):(++*O7,O3);} )++,O5(0010,O7,00))):O3):!(O2-=0563&0215)?O5(011,O7,O5(010,O7,00)):(++*O7,O3);}
main(O2,O7)char**O7;{return O5(O2,O7,O3);}