diff --git a/1988/westley/Makefile b/1988/westley/Makefile index 2fffe9e31..f23f4db10 100644 --- a/1988/westley/Makefile +++ b/1988/westley/Makefile @@ -39,7 +39,7 @@ include ../../var.mk # Common C compiler warnings to silence # CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-return-type \ - -Wno-strict-prototypes + -Wno-strict-prototypes -Wno-implicit-int # Common C compiler warning flags # @@ -62,7 +62,7 @@ CDEFINE= # Include files that are needed to compile # -CINCLUDE= +CINCLUDE= -include stdio.h # Optimization # diff --git a/1988/westley/try.sh b/1988/westley/try.sh index ef88b6f4b..e37ca0aef 100755 --- a/1988/westley/try.sh +++ b/1988/westley/try.sh @@ -1,15 +1,22 @@ #!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1988/westley +# -clear - -if [[ ! -x "westley" ]]; then - echo "$ cc westley.c -o westley" - cc -std=gnu89 -Wno-error -Wno-implicit-function-declaration -Wno-return-type -O3 westley.c -o westley || exit 1 +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" fi -echo "$ cat westley.c" +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + +echo "$ cat westley.c" 1>&2 cat westley.c sleep 1 - -echo "$ ./westley" +echo "$ ./westley" 1>&2 ./westley diff --git a/1988/westley/westley.c b/1988/westley/westley.c index 2bcf1123e..c946907ff 100644 --- a/1988/westley/westley.c +++ b/1988/westley/westley.c @@ -1,5 +1,5 @@ #define _ F-->00||-F-OO--; -int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO() +float F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO() { _-_-_-_ _-_-_-_-_-_-_-_-_ diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index b37f0cc3e..34a9dfa7c 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -758,6 +758,9 @@ was fixed by Misha Dynin, based on the judges' remarks, so that this would work with modern C compilers. We encourage you to try the alternate version to see what happens with current compilers! See the README.md files for details. +Cody changed the `int`s to be `float` as that's what they are printed as: not +strictly necessary but nonetheless more correct, even if not warned against. + Cody added the [try.sh](1988/westley/try.sh) script to show the magic of the entry as seeing the code with the result at once is far more beautiful.