The carefully crafted, self-including code in this IOCCC winning entry from 1988:
http://www.ioccc.org/years.html#1988_isaak
...was still too much for certain systems back then. Also, ANSI C was finally emerging as a stable alternative to the chaotic K&R ecosystem. As a result, the IOCCC judges also provided an ANSI version of this entry:
http://www.ioccc.org/1988/isaak.ansi.c
Its main attraction is its gimmick of including <stdio.h>
in the last line (!) with well-thought-out #define
s, both inside the source and at compile time, to only allow certain parts of the code into the right level. This is what allows the <stdio.h>
header to be ultimately included at the latest stage possible, just before it is necessary, in the source fed to the compiler.
However, this version still fails to produce its output when compiled today, with the provided compiler settings:
gcc -std=c89 -DI=B -DO=- -Dy isaak.ansi.c
tcc -DI=B -DO=- -Dy isaak.ansi.c
Versions used: GCC 9.3.0, TCC 0.9.27
There isn't any evident reliance on the compiled binary filename, hence I left it to the compiler's choice. Even when using -o isaak
or -o isaak.ansi
, the same result happens: no output.
What is causing this? How are the output functions failing? What can be done to correct this?
Thanks in advance!
NOTE: The IOCCC judges, realising that this entry had portability issues that would detract from its obfuscation value, decided to also include a UUENCODEd version of the code's output:
There is nothing remotely portable about this program. As I see it tries to overwrite the
exit
standard library function with its own code, expecting that return from emptymain()
would call thatexit()
, which is not true. And even then, such behaviour is not standard-conforming - even C89 said it would have undefined behaviour.You can "fix" the program on modern GCC / Linux by actually calling
exit();
insidemain
- just change the first line toI compiled
gcc -std=c89 -DI=B -DO=- -Dy isaak.ansi.c
and run./a.out
and got sensible output out.