At college I used to like sending ASCII 0x07 to certain people's /dev/ttyxx at infrequent intervals, just to keep them wondering (it just made their terminal do a beep, apparently for no reason)

The IOCCC is fantastic [Linked Image]

What's more I actually *use* the AG anagram generator, because it's a good way to cheat when you get a very tricky one in a crossword puzzle and even after staring at it for ages it won't come.

I don't think it was ever an entrant in the IOCCC, but did you ever see Duff's device?

Here it is, and it always makes me smile.

send(to, from, count)
register short *to, *from;
register count;
{
register n=(count+7)/8;
switch(count%8){
case 0: do{ *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
case 1: *to = *from++;
}while(--n>0);
}
}


(I've tried a couple of things but I can't get the code to display with proper indentation, which is a shame, because apparently the forum software strips out leading spaces and it ignores tabs too.)

Notice that do { ... } while() loop *intertwined* in the ladder of case statements [Linked Image] It's a beauty, eh?

Here's the article about it that Tomm Duff wrote.
http://www.lysator.liu.se/c/duffs-device.html

[edited to try to fix indentation, unsuccessfully...]

[This message has been edited by jooles (edited 09-03-2005).]

[This message has been edited by jooles (edited 09-03-2005).]

[This message has been edited by jooles (edited 09-03-2005).]