IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

1989/jar.1 - Strangest abuse of the rules

Hello world as a C string

Author:

To build:

NOTE: this will run the program itself.

    make clobber all

There is an alternate version with a slight difference that you may wish to try. See the Alternate code section below for more details.

To use:

    ./jar.1

Alternate code:

This alternate code, which prints something slightly different, is provided as well.

Alternate build:

NOTE: this will run the program itself.

    make clobber alt

Alternate use:

    ./jar.1.alt

Judges’ remarks:

On many systems the compiler will not allow you to send the object file to /dev/tty. The author suggested:

    cc -c -o /dev/tty jar.1.c

As a last resort the jar.1.sh script provided simulates writing the raw binary of the .o object file to the terminal.

Abuse of the rules winning entry usually result in a change of the rules. Starting in 1990, compiling entries must result an regular file which can be executed.

Under certain conditions that are dependent on such diverse things such as:

the output of raw binary to a terminal can produce various effects from the mildly annoying beeps to missing seeing the important output, to various “ill effects” such as the crashing of the terminal application. Instead we have opted to pipe raw binary thru the strings utility before writing to standard output instead of /dev/tty.

As a historical note, the Makefile does echo the original command to standard output, the original shell command that once wrote raw binary to the /dev/tty special file.

The use of piping raw binary thru stings makes the original 1989 output more apparent, as was the case when using dumb CRT terminals (some so dumb that they couldn’t even process simple ANSI escape sequences) was more common.

Author’s remarks:

This program is (supposedly) the smallest C program able to print “Hello world.”. The compilation itself produces the desired printout and the program need not be actually run.

Inventory for 1989/jar.1

Primary files

Secondary files


Jump to: top