Sunday, November 27, 2011

20th International Obfuscated C Code Contest opens online this week

This week [2011-Dec-1] the 20th International Obfuscated C Code Contest, starts taking online submissions.

What is the IOCCC?:

To write the most Obscure/Obfuscated C program under the rules below.
  • To show the importance of programming style, in an ironic way.
  • To stress C compilers with unusual code.
  • To illustrate some of the subtleties of the C language.
  • To provide a safe forum for poor C code. :-)
To translate that, what they mean is they want the hardest possible to read and understand program written in the C language, that is written that way on purpose. No one wants to see your Boss's code that just happens to come out that way.

I know one prominent author in the Embedded Space that mentions the IOCCC, but they never supply a link to it, as they think it is a bad example of how to do Embedded Systems. Obviously I disagree with that as I already gave you the link above.

The reason I disagree, is that the IOCCC usually exploits one of the many problems that those whom are unaware of them could stumble into. I see it as, that if you see how the problem area of the code is being exploited, you will be more likely to remember to never do it that way in your own code.

IOCCC is also a good stress test for any of your software analysis tools, such as Lint, or MISRA compliance suite.

Somewhat related is Gimple Software, maker of my favorite Lint tool, Bug of the Month challenge. They give you a short C program and you have to find the bug in it. Ever wonder why it is called 'Lint'? Because it is nitpicky!

To make IOCCC code at least look readable, won't help with understanding it much, run it through Artistic Style or Indent. Indent is the simplest to use, AS is the most configurable to get the code to look they way you like to see it. Any code I get from someone I run through AS to get a consistent style, such as the brackets on lines by themselves, and consisting indenting.

Let me know what code you submit, or better yet when you win...