less_retarded_wiki/ioccc.md
2022-11-12 15:49:22 +01:00

2.2 KiB

International Obfuscated C Code Contest

The International Obfuscated C Code Contest (IOCCC for short) is an annual online contest in making the most creatively obfuscated programs in C. It's kind of a "just for fun" thing but similarly to esoteric languages there's an element of art and clever hacking that carries a great value. While the productivity freaks will argue this is just a waste of time, the true programmer appreciates the depth of knowledge and creative thinking needed to develop a beautifully obfuscated program. The contest runs since 1984 and was started by Landon Curt Noll and Larry Bassel.

Unfortunately some shit is flying around IOCCC too, for example confusing licensing -- having a CC-BY-SA license in website footer and explicitly prohibiting commercial use in the text, WTF? Also the team started to use Microshit's GitHub. They also allow latest capitalist C standards, but hey, this is a contest focused on ugly C, so perhaps it makes sense.

Hacking the rules of the contest is also encouraged and there is an extra award for "worst abuse of the rules".

Some common ideas employed in the programs include:

  • formatting source code as ASCII art
  • misleading identifiers and comments
  • extreme macro/preprocessor abuse
  • abuse of compiler flags
  • different behavior under different C standards
  • doing simple things the hard way, e.g. by avoiding loops
  • including weird files like /dev/tty or recursively including itself
  • code golfing
  • weird stuff like the main function recursion or even using it as a signal handler :)

And let us also mention a few winning entries:

  • program whose source code is taken from its file name (using __FILE__)
  • ray tracer in < 30 LOC formatted as ASCII art
  • operating system with multi-tasking, GUI and filesystem support
  • neural machine learning on text in < 4KB
  • program printing "hello world" with error messages during compilation
  • X11 Minecraft-like game
  • web browser
  • self-replicating programs