International Obfuscated C Code Contest returns
The IOCCC has returned to collect a fresh batch of mind-bogglingly difficult-to-understand C code
By Joab Jackson | Published: 12:43, 17 November 2011
The International Obfuscated C Code Contest (IOCCC), where programmers write bizarre and unncessarily complex C code, has been resurrected by its creators following a five-year hiatus.
"You can never say all the tricks have been done. Someone always shows you something you didn't know," said Landon Curt Noll, one of the founders of IOCCC. "Every year you think 'Gee, I didn't think you could do that'."
The goal of the contest, as in year's past, is to produce a batch of mind-bogglingly difficult-to-understand code, written in the C programming language. The group will begin accepting submissions for this year's contest from December 1. The deadling for submissions is January 12, 2012.
Related Articles on Techworld
Perhaps ironically, the intent behind the contest is to stress to programmers the importance of good programming style. "One of the things that the contest emphasises is that having a working program is not enough," Noll said. "The code has to be maintainable and adaptable." This means that the code must be easily understandable by someone other than the author, so it can be easily updated and expanded upon by others.
The contest also produces some secondary benefits as well, namely exposing both structural quirks of the C language and weaknesses of the standard compilers. Winning programs have "pushed the boundaries of the C language," Noll said. The Free Software Foundation, for instance, has used entries for regression testing its C compiler.
Noll and Larry Bassel conceived of this contest in 1984. They were both working at National Semiconductor at the time, and had commiserated with each other about the pitiful state of the code to some Unix programs they were updating. Both had complained that not only was the "code was poorly written, but it seemed like someone had put a lot of effort into writing bad code," Noll said.
The IOCCC is now the oldest still-running internet-based contest, Noll said. This year will be the IOCCC's 20th iteration. The keepers of the contest had taken a break to revamp the website so it can accept admissions online, an upgrade that took five years.
The contest is not necessarily looking for badly written code. In fact, writing truly obfuscated code requires a "deep understanding of the language," Noll said, noting that winners in years past have actually been offered jobs (presumably to write non-obsfucated code) based on the expertise they demonstrated for the contest. It takes a good programmer to write bad code, Noll said.
Rather, the judges are looking for code written in such a way that another programmer would have extreme difficulty figuring out what the program actually does.
Noll did not define specifically what makes for winning obfuscated code. "It's like porn. You know it when you see it," he said. Many of the best entries have had multiple layers of obfuscation, where one feature is not only implemented in a completely unintuitive way, but also relies on additional layers obfuscated code.
Past winners have been breathtaking in their sophistication. For instance, Brian Westley, the webmaster for the Firesign Theatre comedy troupe, submitted a program in 2001 that rearranged a line of input and then reorganised itself so that it completed the same task using a different algorithm the next time it ran. "It was a master stroke in understanding the C syntax," Noll said.
And not all programs have to be long. David Korn, author of the widely used Unix Korn Shell, wrote a one-line program for 1987's contest that fools many a C programmer into thinking it doesn't compile (below). Even the C creator Dennis Ritchie initially missed the program's subtle logic, Noll said.
Adding to the challenge is the fact that the rules themselves are not entirely straightforward, beyond a few basic principles, namely that the code must be able to be compiled on a standard ANSI C compiler and must come with documentation that clearly states what the program is supposed to do. Except for these basic principles, the rules change from year to year, in order to keep contestants from relying on proven techniques of obfuscation. "Hacking the contest rules is a tradition," he said.
"We don't do the same thing over and over again," Noll said.