ACCU Home page ACCU Conference Page ACCU 2017 Conference Registration Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Google+ ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

pinC Abuse

Overload Journal #65 - Feb 2005 + Programming Topics   Author: Thaddaeus Frogley

[Editorial note: I have often stated that one must consider the intended audience in any piece of writing. I've also been known to point out that code is a form of writing and that the principal audience, in this case, is not the compiler. This article demonstrates just how much the style of code can be affected by inverting the usual assumption that the intent is to communicate what the code does to your audience. - Alan]

Four years ago I collaborated on the THADGAVIN [thadgavin] entry to the International Obfuscated C Code Contest [ioccc]. It won an award (Most Portable Output), but it was a behemoth, only just scraping inside the maximum size limit for the contest. Much of its complexity was inherent in the algorithm, the obfuscation was a straightforward refactoring, and the reason for the award was mostly due to the use of a cross platform library. In conclusion, while it was a winner, in the end I was not happy with the "art" of the code.

The following year I wrote another entry. This time I wanted to do something functional and minimalist, something with a strong theme, and something self-referential. I had striven, and in my opinion failed, to make the 2000 entry a visual as well as an intellectual appeal. I wanted to do the same again in 2001, but again I wanted to be minimalist. I wanted to create a piece of code that could be considered to be "art" on multiple levels. So here, for your pleasure, I present my short (untitled) program:

/*(c) 2001 Thad */
#include<string.h>
#include <stdio.h>
#define abc stdout
int main(int a,ch\
ar*b){char*c="??="
"??(??/??/??)??'{"
"??!??>??-";while(
!((a=fgetc(stdin))
==EOF))fputc((b=s\
trchr(c,a))?fputc(
fputc(077,abc),abc
),"=(/)'<!>""-"??(
b-c??):a, abc);??>

I encourage you to study it. Try to work out what it does without compiling and running it.

Now, assuming you've worked out what it does, can you work out how many sins are committed in these 14 short lines of code? How many good practice guidelines are broken?

Overload Journal #65 - Feb 2005 + Programming Topics