International Obfuscated C Code Contest
From Wikipedia, the free encyclopedia
The International Obfuscated C Code Contest (abbr. IOCCC) is a programming contest for the most creatively obfuscated C code held annually since 1984 (with the exception of 1997, 1999, 2002, 2003, and 2006).[1] There are many winning entries each year, and each entry gets a category like "Worst Abuse of the C preprocessor" or "Most Erratic Behavior".
The entry deadline for the 2007 contest was February 28, 2007.
The IOCCC was started by Landon Curt Noll and Larry Bassel. They were talking together about the horrible code it was their jobs to maintain. They decided to hold a contest for the worst possible C code. Within the code size limit of only a few kilobytes, the contestants manage to do complicated things — a 2004 winner turned out an operating system [2].
Some quotes from 2004 winners include:
- To keep things simple, I have avoided the C preprocessor and tricky statements such as "if", "for", "do", "while", "switch", and "goto". [3]
- We still aren't sure whether or not this is a useful program, but it's the first atomic fission we've seen in the IOCCC.[4]
- Why not use the program to hide another program in the program? It must have seemed reasonable at the time.[5]
- The program implements an 11-bit ALU in the C preprocessor. [6]
- I found that calculating prime numbers up to 1024 makes the program include itself over 6.8 million times.[6]
Below is a 1988 entry which calculates pi by looking at its own area: [7]
#define _ -F<00||--F-OO--; int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO() { _-_-_-_ _-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_ _-_-_-_ }
(Note that the entry was written in K&R C, it doesn't work correctly in ANSI C without some change[8].)
Some ways in which contributions are notable include:
- The appearance of the source code, which may resemble images, text, etc.
- Preprocessor redefinitions to make code harder to read
- Self-modifying code
- Worst abuse of the rules. In several years, an entry was submitted that was so patently absurd that it required a new definition of some of the rules for the next year. This, of course, is a high honor. An example would be the world's shortest self-reproducing program. The entry was a program zero bytes in length that if run printed zero bytes to the screen (this requires some creative use of the makefile to get it right).[9]
The nature of this contest has naturally resulted in programs which skirt around the edges of C standards, or result in constructs which trigger rarely used code path combinations in compilers. As a result, several of the past entries may not compile directly in a modern compiler, and some may even cause crashes.
[edit] See also
[edit] References
- ^ International Obfuscated C Code Contest years page
- ^ gavin.hint (plain text). IOCCC (2004). Retrieved on 2007-03-13.
- ^ IOCCC 2004 - Best Calculated Risk
- ^ IOCCC 2004 - Best abuse of the Periodic table
- ^ IOCCC 2004 - Best abuse of Indentation
- ^ a b IOCCC 2004 - Best Abuse of CPP
- ^ 5th International Obfuscated C Code Contest, 1988 - westley.c
- ^ using gcc, compile with the following command line: gcc -E r.c | sed 's/- -/--/g' > r2.c ; gcc -o r2 r2.c (The source file is r.c)
- ^ smr.hint (plain text). IOCCC (1994). Retrieved on 2006-09-16.