Slashdot Mirror


2004 IOCCC Winners Source Code Released

Langly writes "The IOCCC have finally released their source code for 2004. My thoughts goes out to the poor guys that actually wrote this code. Reader discretion is advised." Every time I see an obfuscated code contest, I wonder if 'Winner' is the right word to describe the victor ;)

175 comments

  1. frist? by Anonymous Coward · · Score: 5, Funny

    void main(void) {
    printf("frist prost");
    }

    1. Re:frist? by Anonymous Coward · · Score: 1, Funny
      You succeed, but also half fail it:
      frist_prost.c: In function `main':
      frist_prost.c:1: warning: return type of `main' is not `int'
    2. Re:frist? by Anonymous Coward · · Score: 0


      Since when was stdio.h included automatically?

      (I know the code works fine as is, I just find it odd that #include <stdio.h> isn't needed)

    3. Re:frist? by Anonymous Coward · · Score: 2, Informative

      Various standard C library functions are known to the compiler, and the compiler is allowed to optimise them. For example, here's a little trick. If you compile:

      printf("Hello\n");

      With max opt, GCC will convert it into:

      puts("Hello");

      How cool is that? You've saved one byte in your string and called a much quicker/smaller function!

    4. Re:frist? by gorre · · Score: 3, Insightful

      Arrggh, main returns an int god dammit!

      --
      "Madness is something rare in individuals - but in groups, parties, peoples, ages it is the rule." -- Nietzsche
    5. Re:frist? by aled · · Score: 2, Insightful

      So what? it's just a warning. Much the better to ofuscation.

      --

      "I think this line is mostly filler"
    6. Re:frist? by aled · · Score: 1

      The objetive is ofuscation, not efficience.

      --

      "I think this line is mostly filler"
    7. Re:frist? by Tony+Hoyle · · Score: 1

      It also doesn't take a void argument.

    8. Re:frist? by quigonn · · Score: 2, Interesting

      gcc -std=c99 -o frist_prost frist_prost.c works perfectly without warning. By default, gcc still interprets the code as C89.

      --
      A monkey is doing the real work for me.
    9. Re:frist? by pchan- · · Score: 4, Insightful
      It also doesn't take a void argument.

      sure it does. int main(void) is completely legitimate. there's no reason why your program needs to take in commandline arguments. the loader will probably pass them to you anyway, but you don't need to acknowledge their existance.
      $ cat x.c
      #include <stdio.h>

      int main(void)
      {
      printf("sweet\n");
      return 0;
      }

      $ gcc -Wall -std=c99 x.c
      $
    10. Re:frist? by JeffTL · · Score: 0, Offtopic

      Frist? The doctor is in the hou---er, the Senate.

    11. Re:frist? by Kusunose · · Score: 1

      No. main() can take argc, argv pair: int main(int argc, char *argv[])
      or no arguments: int main(void).

    12. Re:frist? by Anonymous Coward · · Score: 0

      Sorry about the void main(void). C is not my first language. (You wouldn't've wanted me to use the MS language I usually work with. =)

      Anyways, to make up for this, here are discussions on void main(void):

      http://users.aber.ac.uk/auj/voidmain.shtml
      http://homepages.tesco.net/~J.deBoynePollard/FGA/l egality-of-void-main.html

      - a.c.

    13. Re:frist? by Anonymous Coward · · Score: 0

      Explain when you call printf() but you havn't provided a declaration for that function, how the compiler knows which printf() you're calling and if the arguments are correct?

    14. Re:frist? by Anonymous Coward · · Score: 0

      return 0;

      I'm sorry but on the OS I'm using, returning 0 from your code causes the entire hard drive to be formatted with SySV UFS and the contents of your $HOME/porn directory to be mailed to your mother.

      Maybe you should have used EXIT_SUCCESS, which is defined in stdlib.h That's what it's for after all.

    15. Re:frist? by Anonymous Coward · · Score: 0

      As I said, the compiler is allow to assume things about certain functions in the standard c library. printf is one of those functions.

    16. Re:frist? by runderwo · · Score: 1

      Obviously you are calling the printf() in the C standard library, since -lc is implied when you compile a C program. If your standard library does not provide printf(), it is broken.

    17. Re:frist? by Anonymous Coward · · Score: 0

      Oh, obviously. Except for the manu situations when you're not using the standard library and -lc is not implicit. Say, when you're building embedded code. Or when you're building a kernel.

      Nice try. For future reference, the correct answer is "It doesn't have a bloody clue". Some compilers might assume you meant to declare that function (Gcc will usually assume a function which returns int and takes exactly the perameters you've passed) but there is nothing in the standard that says a C compiler should do this.

    18. Re:frist? by Anonymous Coward · · Score: 1, Informative
      gcc -std=c99 -o frist_prost frist_prost.c works perfectly without warning. By default, gcc still interprets the code as C89.

      This has nothing to do with C89 or C99. The only standard-compliant forms of main are those that return 'int', regardless of which C standard you are talking about. Also, the -std argument to gcc is not sufficient to make it a standard C compiler. RTFM.

      The -ansi option does not cause non-ISO programs to be rejected gratuitously. For that, -pedantic is required in addition to -ansi. ...
      The -std options specifying some version of ISO C have the same effects as -ansi, except that features that were not in ISO C90 but are in the specified version (for example, // comments and the inline keyword in ISO C99) are not disabled.
    19. Re:frist? by Anonymous Coward · · Score: 0

      Shut up and read your K&R copy, lamers!

      In C you needn't declare your functions. They can be implicitely declared on first use.

    20. Re:frist? by Anonymous Coward · · Score: 0

      I know the code works fine as is...

      No you don't. Using a variadic function without a correct prototype in scope yields undefined behavior.

    21. Re:frist? by Anonymous Coward · · Score: 0

      They can be implicitely declared on first use.

      Only in certain circumstances. Variadic functions are quite explicitly NOT subject to this rule.

      Get a copy of the language standard, lamer.

      (Also, the standard library need not include printf(), unless it is a hosted implementation. Free-standing implementations can leave out all kinds of crap and still be standard-compliant.)

    22. Re:frist? by Anonymous Coward · · Score: 0

      Get a copy of the language standard, lamer.

      And when you do the rules governing this can be found in section 6.5.2.2. Pay particular attention to paragraph 6.

    23. Re:frist? by Anonymous Coward · · Score: 1, Informative
      You need to add the -pedantic argument for this to be very meaningful. From the gcc manual:

      -pedantic
      Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any -std option used.

      Valid ISO C and ISO C++ programs should compile properly with or without this option (though a rare few will require -ansi or a -std option specifying the required version of ISO C). However, without this option, certain GNU extensions and traditional C and C++ features are supported as well. With this option, they are rejected.


      The gcc manual also says:

      Some users try to use -pedantic to check programs for strict ISO C conformance. They soon find that it does not do quite what they want: it finds some non-ISO practices, but not all--only those for which ISO C requires a diagnostic, and some others for which diagnostics have been added.

      A feature to report any failure to conform to ISO C might be useful in some instances, but would require considerable additional work and would be quite different from -pedantic. We don't have plans to support such a feature in the near future.


      So this is not a perfect way of checking compliance, but it is usually fairly good.
    24. Re:frist? by Anonymous Coward · · Score: 0

      ARRRRGGGH. void main()?
      Ginsu attack!

    25. Re:frist? by Anonymous Coward · · Score: 0

      Nope, re-read that section again yourself. Perhaps I grow weary of holding your hand thru basic language structure.

    26. Re:frist? by BreadMan · · Score: 3, Informative

      For GCC, at least, the entry point as far as Linux is concerned is _init, defined in /usr/lib/crti.o.

      _init opens the standard file descriptors, gathers the command line arguments and does a but of housekeeping before calling main, your program's entry point. GCC links to this by default; but you can change this if necessary, for instance an embedded project running without an OS would need very different initialization code, and for that matter it could define the entry point of the application as something other than main().

      If you want to see what GCC is doing for a compilation, try

      gcc =### x.c

      And you'll be able to see what gcc passes to the underlying tools to pre-process, compile, assemble and link.

    27. Re:frist? by Anonymous Coward · · Score: 1, Funny

      Your post was only six words long, and you fucked up three of them.

      Objective.
      Obfuscation.
      Efficiency.

    28. Re:frist? by LanceUppercut · · Score: 1

      Firstly, 'void main' is illegal. 'main' is always 'int'. Secondly, calling a variadic function ('printf' in this case) without declaring it first is illegal.

    29. Re:frist? by LanceUppercut · · Score: 1

      Read it yourself, lamer. You don't need to declare an ordinary (non-variadic) functions. Variadic functions (as 'printf') need to be declared first. Otherwise, the behavior is undefined.

    30. Re:frist? by Anonymous Coward · · Score: 0

      calling a variadic function ('printf' in this case) without declaring it first is illegal.

      To clarify, it's illegal in the sense that it does not have a defined result. It is not, however, required to produce a diagnostic.

    31. Re:frist? by Anonymous Coward · · Score: 0

      Wrong! Variadic functions don't always need to be declared first as stated in the standard. Go re-read the book and try again.

    32. Re:frist? by LanceUppercut · · Score: 1

      Well, it a matter of defining "illegal". The program is well-formed, but produces UB. That's what I meant by "illegal". Whether it will display a diagnostic is a QoI issue.

    33. Re:frist? by LanceUppercut · · Score: 1

      Wrong. C89/C90 (6.3.2.2) and C99 (6.5.2.2/6) clearly and explicitly state that if a function has a prototype that ends with an ellipsis (a variadic function) then calling this function without declaring it first leads to undefined behavior. Take the document and read it, if you know how to read. End of discussion.

    34. Re:frist? by Anonymous Coward · · Score: 0

      It says it "can", but it's not exactly declared. Please re-read the sections.

    35. Re:frist? by LanceUppercut · · Score: 1

      Would you please clarify? What "it can" are talking about and what is not exactly declared?

    36. Re:frist? by Anonymous Coward · · Score: 0

      It can be declared but only if it doesn't lead to undefined behavior, like in the case of "printf". The definition is there, but since it's defined it isn't considered undeclared.

    37. Re:frist? by LanceUppercut · · Score: 1

      I don't understand what are you trying to say here. The standard requires that the function is declared in the same translation unit _before_ (i.e. above the point where) it is called. This requirement is violated by the code in question.

    38. Re:frist? by Anonymous Coward · · Score: 0

      But that's only if it is not defined beforehand elsewhere in the unit. Else it will be considered undeclared and possibly lead to undefined behavior, as defined in the standard.

    39. Re:frist? by LanceUppercut · · Score: 1

      Well, that's exactly what we have in this case. This translation unit neither declares nor defines 'printf'. Which immediately means that calling it without a prototupe leads to undefined behavior.

    40. Re:frist? by Anonymous Coward · · Score: 0

      Yeah, that's what I said.

    41. Re:frist? by JeffWhitledge · · Score: 0

      Gentlemen, can we please get back to the name-calling?

      --
      These comments do express the opinions of my employers, and, personally, I think they're complete rubbish.
    42. Re:frist? by Anonymous Coward · · Score: 0

      Shit, when was comp.lang.c.slashdot newgrouped?

    43. Re:frist? by Anonymous Coward · · Score: 0

      Sorry, but on any conforming C implementation the entry point is _start, which is tradionally defined in crti.o (Linux and other GNU systems may also have crt1.o and crtn.o) Now _init() is a symbol which exists and is called before main(), but only on systems using GNU libc. It usually does a bit of housekeeping within Glibc, sets up a few things (E.g. fills in some details in the _rtld_global structs) and then calls main() for you, then when main() returns it cleans up behind you.

      Yes, I am hacking on Glibc.

    44. Re:frist? by Anonymous Coward · · Score: 0

      Naturally. However, since you don't provide a prototype for it, the compiler doesn't know that it's variadic.
      Then, if you happen to be lucky enough that your platform variadic functions follow a calling convention different from normal functions, this will probably result in immediate massively parallel launch of intercontinental ballistic nasal daemons or somesuch. Don't try this at work.

    45. Re:frist? by dtfinch · · Score: 1

      I'm sure it was intentional.

    46. Re:frist? by Mr+Z · · Score: 1

      Actually, the code does not work fine on some compilers.

    47. Re:frist? by Mr+Z · · Score: 1

      errrr... I don't think there's anything in ANSI or ISO C that defines _start. When you say "conforming," do you mean "conforming to my system's ABI"?

      --Joe
    48. Re:frist? by BreadMan · · Score: 1

      >> When you say "conforming," do you mean "conforming to my system's ABI"?

      Good point. :-) What happens before main() is left to the implementation, so it is a matter of the system's ABI as to the entry point's actual name. IIRC, Windows expects _mainCRTStartup as the entry point, which then calls main().

    49. Re:frist? by Anonymous Coward · · Score: 0
      Sheesh. At least pretend to obfuscate it. Something like this ought to do:
      #define _a(a) (((unsigned)(a-'a') <26)?(a=(13+a-'a')%26+'a'):0)
      #define _b(a,b) (_a(a),a^=b,b^=a,a^=b,_a(a))
      main(){char a=0,b[]="gfbec gfves\n"; for(;a<5;++a)_b(a[b],b[10-a]);printf(b);}
  2. obfuscated server by LiquidCoooled · · Score: 5, Funny

    The code running on the webserver must be AMAZING.
    Its so obfuscated that I cant even see it!

    ahhhhhh its finally shown up.

    Doesnt bode well though.

    --
    liqbase :: faster than paper
  3. ouch by mpost4 · · Score: 3, Interesting

    I would hate to have to be the one that either updates that code or has to read it. Some nice ASCII art in there, I am not brave enough to test to see if the programs do what they say they do. I went to the spoiler page so I could get the synopsis of them. That code would be a good Halloween costume it is just scary.

    1. Re:ouch by mikael · · Score: 0, Offtopic

      You could always get a Knoppix CD, boot up your PC using that, then try the programs.

      --
      Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
    2. Re:ouch by ajs · · Score: 5, Insightful

      I'm so tired of this. Every time the IOCCC winners are announced someone has to go off on how unmaintainable the code is.

      For those who are unable to grasp the point, I'll say it slowly: this code is written by people who understand C well enough to twist it into any shape they please. Of course, they could write clean, maintainable code, but then they would LOSE the competition. The goal is to write obfuscated code.

      The IOCCC is an expression of source-code as art in a compettitive forum. If that isn't your cup of tea, don't hurt your brain by reading the submissions.

    3. Re:ouch by Anonymous Coward · · Score: 0

      AC:DUCK!! mp:What was that? AC: The point. Fortunately it missed you. In Soviet Russia, point misses you!!

    4. Re:ouch by Artifakt · · Score: 1

      We hope the contest obfuscation is all intentional. Personally, if I write obfuscated C it's mostly inadvertent, and if I write obfuscated C++ it's the PHB's fault.

      --
      Who is John Cabal?
    5. Re:ouch by Megaweapon · · Score: 1

      Perhaps the person would rather try to enter a "Maintainable Brainfuck" competition. The true beauty of the IOCCC is the fact that it will hurt your brain to comprehend it.

      --
      I'm sure "SlashdotMedia" will improve on all the wonders that Dice Holdings blessed us all with
  4. Article text? by Moby+Cock · · Score: 1

    Man, /.'ed already. Anybody manage to grab the text? Please?

    1. Re:Article text? by RPI+Geek · · Score: 1

      Unfortunately it's really just a list of the entries. I couldn't even get to the challenge description before it caught fire.

      --

      - "Nobody came out that night, not one was ever seen. But Old Man Stauf is waiting there, crazy sick and mean!"
  5. Mirror this already! by Anonymous Coward · · Score: 0

    Set up a mirror, you lazy bunch of lazy people.

    1. Re:Mirror this already! by Anonymous Coward · · Score: 5, Informative

      There are several mirrors. I know, I run one of them. Why the submitter hardcoded the us one is beyond me.

      • Antarctica
        none yet :-)
      • Africa
        none
      • Australia and other Pacific
      • www.au.ioccc.org - Sydney, Australia (34 0' S 151 0' E)
      • Extraterrestrial
        SETI is looking for some sites :-)
      • South America
        none
  6. Big deal by Anonymous Coward · · Score: 5, Funny

    When I was learning programming, I would obfuscate code so bad that even the compiler couldn't understand it, let alone humans...

    1. Re:Big deal by jonadab · · Score: 1

      > When I was learning programming, I would obfuscate code so bad that even
      > the compiler couldn't understand it, let alone humans...

      The trick is to write the code so that the compiler understands it in a
      completely different way from any human reader, so that, upon seeing the
      output, the poor human goes, "How does it DO that? This code shouldn't
      get that result... heck, it shouldn't even compile!"

      --
      Cut that out, or I will ship you to Norilsk in a box.
    2. Re:Big deal by UserGoogol · · Score: 1

      No, the trick is to write code which human readers interpret in one way and the compiler interprets in a completely different way. Obfusteganography, if you will.

      "Hey! Why's that Hello World program running a four function calculator?"

      That would be really cool, in a stupid sort of way.

      --
      "Never attribute to malice that which can be adequately explained by stupidity." -- Hanlon's Razor
  7. great performance by fizze · · Score: 1

    wow, the early /. effect seems to be quite popular these days. no comments by now, and almost slashdotted already.....

    --
    Powerful is he who overpowers his temptations.
    1. Re:great performance by saintp · · Score: 1

      It doesn't even look like Coral or Mirrordot got caches of the page before it Hindenburged. Dang.

    2. Re:great performance by Anonymous Coward · · Score: 0

      maybe people are starting to *GASP* read the articles before commenting??

  8. Follow up story. by AtariAmarok · · Score: 5, Funny

    "Within 20 minutes of the code release, SCO sued claiming that it contained something of theirs".

    --
    Don't blame Durga. I voted for Centauri.
  9. Great article summaries lately... by Anonymous Coward · · Score: 0

    And just what the hell is an IOCCC?

    1. Re:Great article summaries lately... by RPI+Geek · · Score: 2, Informative

      International Obfuscated C Code Contest (I think).

      This groups releases a challenge each year that the entrants have to solve using the most obfuscated C code possible. They judge tne entries and award prizes to the best of the worst. Previous entries have used the precompiler to do much of the work, eliminated brackets and spaces, hacked the stack, and generally used many other tricks to complete the challenge.

      --

      - "Nobody came out that night, not one was ever seen. But Old Man Stauf is waiting there, crazy sick and mean!"
    2. Re:Great article summaries lately... by Noksagt · · Score: 1
      And just what the hell is an IOCCC?
      International Obfuscated C Coding Contest.

      I actually thought it was clever how the story on an obfuscated coding contest was, iteself, obfuscated.
    3. Re:Great article summaries lately... by Scarblac · · Score: 4, Interesting

      And best of all, that ridiculous code is REALLY AMAZINGLY POWERFUL in many cases.

      I only looked at the first entry, anonymous.c. It's 47 utterly incomprehensible lines. What it does is convert text into one of Tolkien's Elvish fonts - and the result looks rather nice, for such a tiny C program (that doesn't use any libraries apart from stdlib, stdio and string).

      I took the example from the hint file, pasted only the first half ("ash nazg durhbatuluhk, ash nazg gimbatul") and created a picture, then converted it to PNG with ImageMagick. The result is here. I think that's rather good.

      And that's just the first one of this year. Many of the entries of earlier years were stunning.

      --
      I believe posters are recognized by their sig. So I made one.
    4. Re:Great article summaries lately... by An+ominous+Cow+art · · Score: 1

      Bah, you could do the same with 2 lines of Perl and be 10e8 times more obfuscated :-).

      But seriously that is very impressive.

    5. Re:Great article summaries lately... by Coryoth · · Score: 2, Informative
      And best of all, that ridiculous code is REALLY AMAZINGLY POWERFUL in many cases.

      I only looked at the first entry, anonymous.c. It's 47 utterly incomprehensible lines. What it does is convert text into one of Tolkien's Elvish fonts


      I was fairly impressed with Gavin.c. It's 165 lines of nicely indented/formatted C code that's pretty much incomprehensible. What does it do? It's a 32 bit multitasking operating system complete with a GUI, a shell, and a text viewer called vi.

      Or perhaps Vik1.c - 63 lines (including a comment :-), that when compiled gives you an X11 racing game. But check out the feature list:

      • Drive on a road in a 3-d landscape with hills and curves
      • Mountains in the horizon
      • A sun in the sky when driving during the day.
      • Dark sky and reduced visibility when driving at night.
      • Snow when driving in the winter.
      • Slippery road when driving in the winter.
      • When driving off the road, the car slows down to a halt
      • Three different race tracks that takes about one minute to complete.
      • Speed meter.
      • Computer driven opponent cars.
      • Collision detection when driving into other cars.
      • Lap time measurement.
      • The best lap time is stored as reference.


      Not bad for 63 lines of C code.

      Jedidiah.
  10. More C-related sillyness by cjellibebi · · Score: 2, Interesting

    Slightly offtopic, but this will serve the needs of those of us reading this thread for a fix of C-related humour. The Infrequently asked questions in C (C-IAQ).

  11. Oh the irony by agent+dero · · Score: 5, Funny

    An obfuscated code contest article has a Microsoft "Get the Facts" ad beneath it.

    Does the OSTG try to be subtle or what? :-P

    --
    Error 407 - No creative sig found
    1. Re:Oh the irony by Anonymous Coward · · Score: 0

      That's unlikely to be intentional. On the other hand, I saw an article in UPI about the man who committed suicide at Ground Zero to protest Bush's reelection. Smack in the middle of the article was a huge banner ad with a jubilant Bush and the words "Celebrate Victory!" Now that can't be coincidence.

    2. Re:Oh the irony by ch-chuck · · Score: 1

      even better if it was this one

      --
      try { do() || do_not(); } catch (JediException err) { yoda(err); }
  12. Mirrors by mozingod · · Score: 5, Informative

    Google cache with different mirrors across the globe: http://64.233.167.104/search?q=cache:LAIfxt7dfOEJ: www.ioccc.org/+ioccc&hl=en

    1. Re:Mirrors by yorugua · · Score: 1

      This one is still working : http://www.es.ioccc.org.nyud.net:8090/years.html . please, use nyud.net:8090 while at it...!! :)

    2. Re:Mirrors by Anonymous Coward · · Score: 0

      Great. Except you didn't appear to notice that all of the "mirrors" listed are on .ioccc.org, and that they're all /.'ed

    3. Re:Mirrors by DocMax · · Score: 1

      Of course, if the "Yes-No-No-No-No-No..." poll taught us anything, it's that even when we have 10 mirrors to choose from, most of us will end up hitting the same mirror. For the mirrors it's like a game of Russian roulette.

  13. clueless submitters by jbellis · · Score: 3, Interesting

    I wish the submitters for these things understood that 90% of the obfuscation is done post-debugging with perl scripts... (The remaining 10% is the clever part.)

    1. Re:clueless submitters by RangerRick98 · · Score: 5, Funny

      Actually, 90% of obfuscation is perl scripts. :)

      <runs>

      --
      "You're older than you've ever been, and now you're even older."
    2. Re:clueless submitters by willisachimp · · Score: 5, Interesting
      Actually, I work with the guy who wrote the 'gavin' (the best of show this year), and know for a fact that the final version you see is *very* similar to his development version. Pretty much the only difference is shorter, meaningless variable names and running it through indent (thus giving no information in the indentation, by using a standard indentation tool)

      What you see is how he wrote it - he really is that sick :-D

      I'm so glad he doesn't write like this when he's working. Well, not often, anyway.

    3. Re:clueless submitters by jonadab · · Score: 1

      Yeah, but if you want to write Perl code that many Perl programmers have
      trouble reading, you have to use functional programming techniques that you
      learn from the lisp/scheme programmers. Running the input through a map
      that returns a closure each iteration is a good place to start.

      --
      Cut that out, or I will ship you to Norilsk in a box.
  14. Mirror of source tarball by spydir31 · · Score: 1

    here we go, Mirror
    please don't kill me

    1. Re:Mirror of source tarball by spydir31 · · Score: 1

      okay, seeing as there are official mirrors, I'm removing mine

  15. Time to brush up on your l33t coding skills by GillBates0 · · Score: 5, Funny
    How to write unmaintainable code

    Some gems:
    Naming variables :
    #1 Baby names: Buy a copy of a baby naming book and you'll never be at a loss for variable names. Fred is a wonderful name, and easy to type. If you're looking for easy-to-type variable names, try adsf or aoeu if you type with a DSK keyboard.

    #17 Bedazzling Names: Choose variable names with irrelevant emotional connotation. e.g.:
    marypoppins = ( superman + starship ) / god;
    This confuses the reader because they have difficulty disassociating the emotional connotations of the words from the logic they're trying to think about.

    #26 Misleading names: Make sure that every method does a little bit more (or less) than its name suggests. As a simple example, a method named isValid(x) should as a side effect convert x to binary and store the result in a database.

    --
    An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
    1. Re:Time to brush up on your l33t coding skills by smcdow · · Score: 1
      How to write unmaintainable code...

      Code maintanence is a business consideration, not one for computer scientists.

      --
      In the course of every project, it will become necessary to shoot the scientists and begin production.
    2. Re:Time to brush up on your l33t coding skills by itsNothing · · Score: 2, Funny
      The weirdest naming i saw was while trying to help an undergraduate work on a program:
      one = 4
      two = 3
      three = one + two
      The benefit is that you're pretty sure not to run out of variable names. The downside is that this is a real problem to try to follow after a VERY short time.
    3. Re:Time to brush up on your l33t coding skills by cavebear42 · · Score: 1

      I always liked using similer variable names and names that mean things to programmers

      Class
      class
      CLASS
      c1ass
      Classe
      classe
      case
      Case
      CASE

      all in the same code.

    4. Re:Time to brush up on your l33t coding skills by Anonymous Coward · · Score: 0

      I really do use names when coding up quick test programs.

      Usually Joe, Jim, Sam, etc. Short names.

    5. Re:Time to brush up on your l33t coding skills by jonadab · · Score: 1

      I prefer, if the language in question allows it, to use variable names
      containing unicode characters that are similar in appearance, so that for
      example one variable might have the letter omicron where another has the
      Latin letter o, and one variable might have a capital rho where another
      has a Latin capital P. This will be possible for example in Perl6. Abuse
      of soft references that do mildly exotic things (e.g., call a closure) to
      determine the variable name can also be fun.

      In Perl it's also possible, at least in theory, to just about completely
      avoid supplying any variable names, by abusing magic variables, such as $_
      (in Perl5) or the current topic (in Perl6). However, this is only hard to
      read for people who don't think in Perl, so it needs to be combined with
      additional obfuscatory techniques, such as mimicry of other languages,
      extensive abuse of pack and unpack, nested self-modifying string evals,
      and so on and so forth.

      --
      Cut that out, or I will ship you to Norilsk in a box.
    6. Re:Time to brush up on your l33t coding skills by Anonymous Coward · · Score: 0

      Most traditional BSD/Unix code is so unreadably abbreviated anyways, does anybody need more

  16. The value of not being seen by downward+dog · · Score: 5, Funny

    In this film we hope to show how not to be seen. This is "Hello World" by Mr. E. R. Bradshaw of Cambridge, MA. It can not be seen. Now I am going to ask the code to stand up. "Hello World," will you stand up please. This demonstrates the value of not being seen.

    1. Re:The value of not being seen by Drantin · · Score: 1

      If anyone doesn't get the joke, go watch some of Monty Python's "And Now, For Something Completely Different"

      --
      Actio personalis moritur cum persona. (Dead men don't sue)
  17. Obfuscated webserver by dk.r*nger · · Score: 3, Funny

    Their webserver is actually written in obfuscated c++ .. Sure, it's slow, but the binary plays a technoversion of Star Sprangled Banner when piped through /dev/dsp ..

    1. Re:Obfuscated webserver by Anonymous Coward · · Score: 0

      Actually one of the contest entries is a tiny obfuscated-C web server, complete with CGI support and everything, and according to the notes it could serve everything from IOCCC.org...

    2. Re:Obfuscated webserver by achowe · · Score: 3, Informative
      Yes. I wrote it and I'm rather proud of that entry. You can see it working here:
      http://hibachi.snert.org:8008/
      Version 2.1, the Unobfuscated Posix Windows threaded version will be released sometime soon. If anyone is interested in testing it, email me.
    3. Re:Obfuscated webserver by Eneff · · Score: 2, Funny

      I was so unbelievably depressed when I read your entry, I just about went into my Boss's room and quit on the spot.

      I bow and commit seppaku in honor of your programming prowess.

  18. Every day by 3770 · · Score: 5, Funny

    Hey,

    I write code like that every day for a living.

    I'm just about to finish a world wide, 3-tier, trouble ticketing system in the shape of a Maze.

    --
    The Internet is full. Go Away!!!
    1. Re:Every day by RobertB-DC · · Score: 2, Funny

      Sometimes, .sigs mesh with comments in particularly interesting ways:

      I'm just about to finish a world wide, 3-tier, trouble ticketing system in the shape of a Maze.
      Don't write code, generate it using XML and XSLT with Visual Studio XGen


      I just hope the XGen development team has a good sense of humor...

      --
      Stressed? Me? Of course not. Stress is what a rubber band feels before it breaks, silly.
    2. Re:Every day by 3770 · · Score: 2, Funny


      I couldn't tell you if the XGen development team has a good sense of humor. What I _can_ tell you is that I'm the only developer in that project.

      It is also an open source project so you could see the source code.

      --
      The Internet is full. Go Away!!!
    3. Re:Every day by Anonymous Coward · · Score: 1, Funny

      I'm just about to finish a world wide, 3-tier, trouble ticketing system in the shape of a Maze.

      So you're the one who's developing PeopleSoft 9?

    4. Re:Every day by 3770 · · Score: 1


      Hahaha... :)

      Good comeback.

      --
      The Internet is full. Go Away!!!
    5. Re:Every day by TheLink · · Score: 1

      "I'm just about to finish a world wide, 3-tier, trouble ticketing system in the shape of a Maze"

      "It[Xgen] is also an open source project so you could see the source code."

      Right. Next thing you'd be linking to goatse.cx.

      --
  19. Official IOCCC mirrors by Anonymous Coward · · Score: 3, Informative
    IOCCC Mirrors

    Asia


    Europe

    North America
  20. ugh. by numbski · · Score: 1

    I went looking for the classic Larry Wall obfuscation for classic's sake, but now I'm having a hard time finding it. *sigh*

    Double-rot-13 obfuscation! :)

    --

    Karma: Chameleon (mostly due to the fact that you come and go).

    1. Re:ugh. by mislinux · · Score: 1

      This is still one of the best. Had a friend show it to me after look at this year's "winners" http://www1.us.ioccc.org/1988/phillipps.c

  21. Wow Taco... by Anonymous Coward · · Score: 0

    Every time I see an obfuscated code contest, I wonder if 'Winner' is the right word to describe the victor ;)

    Talk about obfuscated code, or do a View Source on any slashdot page to see the shit HTML spewed forth by this, ahem, CMS.

  22. Mirrors ... by foobsr · · Score: 4, Informative

    http://www.de.ioccc.org/years.html#2004

    also tw, au, es, www1.us

    CC.

    --
    TaijiQuan (Huang, 5 loosenings)
  23. Wow, that's the ultimate obscuring.... by Dj · · Score: 1, Funny

    You can't get better than obfuscation by slashdotting.

    --
    "You know you want me baby!" - Crow T Robot
  24. OK Mr Supar Comuputar by stratjakt · · Score: 5, Funny

    I wonder if 'Winner' is the right word to describe the victor

    This is coming from the dingus behind slashcode.

    --
    I don't need no instructions to know how to rock!!!!
    1. Re:OK Mr Supar Comuputar by Anonymous Coward · · Score: 0

      Would you believe 'non-looser'?

  25. Another mirror by DoctorEternal · · Score: 3, Informative
  26. Simple trick for beginners by grungeman · · Score: 4, Funny

    Name your variables A1, Al, B1, Bl, and so on. With some fonts (especially those fixed width fonts in code editors) a "l" (small "L") looks exactly the same as a "1" (a one), which makes sure that the guy maintaining the code will have fun a-plenty.

    --

    Signature deleted by lameness filter.
    1. Re:Simple trick for beginners by JollyFinn · · Score: 1

      It isn't usefull unless you make sure that automatic search and replace will break the code. You should USE that in somewhere else like "Al" or "Bl" or A1h or B1h it will make it more funny indeed. Then reuse that as a FILE name. And make sure to use clever arithmetics to generate OTHER file name from that file name so that you won't out run a save file names ;)

      --
      Emacs is good operating system, but it has one flaw: Its text editor could be better.
    2. Re:Simple trick for beginners by radja · · Score: 0

      A1, Al, A1l,A11,All, Al1 etc...

      --

      No one can understand the truth until he drinks of coffee's frothy goodness.
      --Sheikh Abd-Al-Kadir, 1587
    3. Re:Simple trick for beginners by mopslik · · Score: 5, Interesting
      Bah, why use "A" and "B" when "I" (capital i) will do the trick even better?

      Examples:
      I1I1 (eye one eye one)
      IlIl (eye ell eye ell)
      lIll (ell eye ell ell)
      etc.
    4. Re:Simple trick for beginners by Ford+Prefect · · Score: 1

      With some fonts (especially those fixed width fonts in code editors) a "l" (small "L") looks exactly the same as a "1" (a one), which makes sure that the guy maintaining the code will have fun a-plenty.

      For ease of writing such horrid code, I recommend the Bistream Vera Sans Mono typeface. All those characters can be distinguished from each other, and there are bold, italic and bold-italic variants for your syntax highlighting needs. Just because you want to confuse and antagonise your fellow cow-orkers doesn't mean you have to suffer yourself!

      Download 'em here... :-)

      --
      Tedious Bloggy Stuff - hooray?
    5. Re:Simple trick for beginners by Anonymous Coward · · Score: 0

      Heh, that makes me think of poor Silicon Image. They make chipsets. One being the popular SATA controller.

      It's a "SiI" chipset, yet 99% of people write "Sil". Like the SiI3114 (not Sil3114 you morons).

    6. Re:Simple trick for beginners by PrestoChango · · Score: 1

      I'm more partial to sequences of zeroes and capital "O"s. It doesn't look to strange in HTML, but I've seen a few default editor fonts where 0 and O differ by 2 pixels.

      O0OO00O0 = ( O0OO + OO0O) / OO0

    7. Re:Simple trick for beginners by antispam_ben · · Score: 1

      It isn't usefull unless you make sure that automatic search and replace will break the code. You should USE that in somewhere else like "Al" or "Bl" or A1h or B1h it will make it more funny indeed.

      The A1h's (that some assemblers would take as a hex value A1) should remind one to also use these strings as hex constants: 0xA1, 0xB1, and of course have idenfifiers starting with the letter O as OxA1, OxBl, Oxe4c. (okay, I had to use a little hac|3r 5p33|k - hmm, don't recall seeing any of that in these entries. Is it disallowed, the judges not like it, none of the winning entries happened to have any, or did I miss one?).

      I attempted to write something obfuscated many years back, I though it would be funny to have some #defines and such that would make the code's main body look like FORTRAN, Cobol or BASIC code, or even just a short sentence, "Now is the time for all good men to come to the aid of their country" or "The quick brown fox jumped over the lazy dog."

      C is absolutely the perfect programming language for such a contest.

      --
      Tag lost or not installed.
  27. That's nothing by Anonymous Coward · · Score: 1, Funny

    I could obfuscate code so bad that it would crash the compiler, impregnate the linker and produce a fat binary.

    Free iPod Photo | Free Flat Screens | It really works!

  28. Is This Necessary? by Mignon · · Score: 4, Funny

    Hasn't obfuscated C already been perfected?

    1. Re:Is This Necessary? by Nicolay77 · · Score: 2, Informative

      Well, then you should know that Larry Wall was a winner of the IOCCC in 1987.

      --
      We are Turing O-Machines. The Oracle is out there.
  29. Oh noooooo by ewe2 · · Score: 2, Funny


    Every time I see an obfuscated code contest, I wonder if 'Winner' is the right word to describe the victor ;)


    I certainly feel like a loser when I read obfuscated code!

    --
    insecurity asks the wrong question irritation gives the wrong answer
  30. Gotta love it. by jcuervo · · Score: 4, Funny
    Check out vik1.c:
    /* Some more code */
    I think they gave him extra points for the comment.
    --
    Assume I was drunk when I posted this.
  31. Geekdom has it's award ceremonies. by Anonymous Coward · · Score: 0

    These are they. From IOCCC past, I love this entry

  32. Size does matter! by mwvdlee · · Score: 5, Interesting

    Why not just differentiate by varying the length of the names?

    xxxxxxxxxxxxxx = xxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx / xxxxxxxxxxxxxxxx;

    Makes sense, doesn't it? And it works with every letter of the alphabet too!

    --
    Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    1. Re:Size does matter! by Anonymous Coward · · Score: 0

      This is better. And you can use some

      #define X XX ## XXX

      so no-one can do program-wide search-and-replace

  33. Even more obfuscated code by Anonymous Coward · · Score: 3, Funny

    If you want to take a look at some code that's a real mess, try this code here.

    Ugh.

    1. Re:Even more obfuscated code by fbonnet · · Score: 1

      Rottenflesh ain't bad either as a Freshmeat parody.

  34. IOCCC = International Olympic Committee CompCenter by Anonymous Coward · · Score: 0

    Uh? IOCCC = International Olympic Committee Computa Center? ;-)

  35. IOC code? by MrCocktail · · Score: 2, Funny

    I read the title a little too fast, collapsed all the C's together, and wondered out loud when coding became an Olympic sport...

  36. Obfuscation of the English language by Byzandula · · Score: 1

    "My thoughts goes out to the poor guys that actually wrote this code."

    I've never had more than one thought GOES out anywhere. Perhaps it is time for a language obfuscation contest.

    1. Re:Obfuscation of the English language by Dr.+Shim · · Score: 1

      It's called Engrish.com. And no, the above entry wouldn't make it in, unfortunatly.

      --
      People discover the meaning of life between getting piss drunk and the following hangover.
  37. mkentry.c? by hkb · · Score: 1

    Jesus, I thought that since mkentry.c was so obfuscated, and at the top that is was the winning entry.

    Imagine my surprise when I found out that this was supposed to be normal, radable code.

    --
    /* Moderating all non-anonymous trolls up since 2004 */
    1. Re:mkentry.c? by hkb · · Score: 1

      err, readable.

      --
      /* Moderating all non-anonymous trolls up since 2004 */
  38. Centrinia by Ann+Coulter · · Score: 2, Interesting
    Centrinia has a base library that is written in C. Since C does not have namespace features, I did the next "best" thing: explicitly have the entire namespace in each global identifier. Take a look at my web site at http://www.student.gsu.edu/~zliu2/centrinia.html to see my rationel. An example of my natural number routine name is
    centrinia___base___N___large___arithmetic___multip lication
    (without the space(s)). Again, the rationel for this is on the web site.
    1. Re:Centrinia by Anonymous Coward · · Score: 0

      Be careful!! In c, only the first 32 characters of a variable name have to be read. so

      ssssssssssssssssssssssssssssssssssssd = 4;
      ssssssssssssssssssssssssssssssssssssx = 5;

      Might assign to the same variable!

    2. Re:Centrinia by Ann+Coulter · · Score: 1

      That is why i'm going to have a code prepended to each identifier. This will look extremely ugly but the premise is that there will be a certain number of characters, about 6 for 56800235584=(62 = 26 + 26 + 10)^6 unique identifiers. I originally thought that 30 "digit" identification "numbers" be prepended. But a later thought is to have a total of m = (62^30 + 62^29 + ... 62) identifiers. This can be done because the underscore is not in the 62 digit character set and can be used to denote the end of an identifier. I would use about three (n=238328) or four (n=14776336) digits followed by the path and function name. This should make it portable to all compilers.

    3. Re:Centrinia by Anonymous Coward · · Score: 0

      If you're interested in C++ compatibility, don't put double underscores in your identifiers (yes, that does mean triple underscores aren't allowed either).

    4. Re:Centrinia by p3d0 · · Score: 1
      From the rationale...
      In the future, the Author will create a language that emphasizes speed and portability.
      Aha. Join the club. Here's hoping you're one of those special few who actually succeed in creating a useful programming language that others actually use.
      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    5. Re:Centrinia by pclminion · · Score: 1
      My God dude, I downloaded that library a long time ago and was wondering what the hell you were smoking...

      I still don't agree with it at all :-/

    6. Re:Centrinia by jonadab · · Score: 1

      > Since C does not have namespace features, I did the next "best" thing:
      > explicitly have the entire namespace in each global identifier.

      Much of Emacs is written this way. (I'm talking about the parts written in
      elisp, not the basic pieces written in C.)

      --
      Cut that out, or I will ship you to Norilsk in a box.
    7. Re:Centrinia by multipartmixed · · Score: 1

      static

      dlopen

      ever heard of either of them?

      --

      Do daemons dream of electric sleep()?
    8. Re:Centrinia by Old+Wolf · · Score: 1

      All names containing double-underscores are reserved for use by the implementation, if you want to be portable then you should switch them to singles.

  39. Inline Article Links by Dr.+Shim · · Score: 1

    Clicking on inline hyperlinks in articles on Slashdot is really amusing. What you guys next time can do, is just post a link to the Google cache of the website in particulare.

    I'm sure it'll save a few expensive phone-calls. ;)

    --
    People discover the meaning of life between getting piss drunk and the following hangover.
  40. n869.pdf, 7.20.4.3 by Anonymous Coward · · Score: 0

    5 Finally, control is returned to the host environment. If the value of status is zero or
    EXIT_SUCCESS, an implementation-defined form of the status successful termination is
    returned. If the value of status is EXIT_FAILURE, an implementation-defined form
    of the status unsuccessful termination is returned. Otherwise the status returned is
    implementation-defined.
    ..but thanks for playing anyway.

    1. Re:n869.pdf, 7.20.4.3 by Anonymous Coward · · Score: 0

      O.K you got me, but I wanted to make a point. Note that the return value of EXIT_FAILURE is not defined with such simplicity. Returning a fixed integer is just bad practice.

  41. A tutorial by Smallest · · Score: 2, Interesting
    --
    I have discovered a truly remarkable proof which this margin is too small to contain.
  42. graah.. by Anonymous Coward · · Score: 0
    I keep forgetting that this damn thing fucks up formatting if you start a paragraph like

    ...this

  43. text formatting? please. by mgoodman · · Score: 1

    the entries that relied simply on obfuscation via text formatting (although that anime one looked kinda cool), kind of took the easy way out.

    i mean, realistically, how hard is it to strip out white space in vi or some other editor that has find/replace? once the white place is gone, place tabs as appropriate.

    real obfuscation comes from indecipherable variable names, unused variables, complex algorithms that accomplish no more than simple iteration, etc.

    besides, the best way to write obfuscated code in C is to write it in one big string that is really just PERL -- and then use C to recreate PERL. I mean, come on guys: PERL = OBFUSCATION.

    pussies.

    --
    01100111 01100101 01110100 00100000 01101111 01110101 01110100 00100000 01101101 01101111 01110010 01100101 00101110
    1. Re:text formatting? please. by jonadab · · Score: 1

      Agree about whitespace, but...

      > real obfuscation comes from indecipherable variable names, unused variables,

      No, these things are pretty trivial to deobfuscate. Like the whitespace,
      you do them, just for the added visual effect, but they only contribute a
      little to the overall difficulty of deciphering the code.

      > complex algorithms that accomplish no more than simple iteration, etc.

      Counterintuitive algorithms are good. Abuse of obscure language (or compiler)
      quirks can also be fruitful territory. Most of the best obfuscations that
      I've seen, however, center around obfuscating the code in entirely another
      language from the one the contest centers on, then writing an obfuscated
      interpreter for that language in the contest language. For example, for the
      Obfuscated Perl Competition, you might write the actual functional part of
      your code in obfuscated Postscript and integrate a PostScript interpreter
      written in the best/worst obfuscated Perl you can manage. For the IOCCC,
      you might write your entry in Threaded Intercal and then wrap it up in a
      Threaded Intercal interpreter that you write in the most obfuscated C you
      can manage.

      --
      Cut that out, or I will ship you to Norilsk in a box.
  44. hee hee by mattyrobinson69 · · Score: 1

    wouldn't look good on a CV: ...and in 2004 i wrote the most obfusicated code known to man..

    1. Re:hee hee by achowe · · Score: 1

      Actually having mentioned I won previous years of the IOCCC on my CV has helped me get interviews. Some are just curious, others want to know how wacko I might be.

  45. What happened to the voting software? by Anonymous Coward · · Score: 0

    Wasn't the same guy running a voting software competition that was supposed to have ended earlier this month? I would love to see the entries on that.

    1. Re:What happened to the voting software? by Xcott+Craver · · Score: 1
      Do a Google search on "obfuscated v" to see the entries of the obfuscated voting contest. The contest was judged a while ago, and there are some clever submissions there. One of them still baffles me.

      I submitted this as a story when the winners were announced, but it was rejected.

  46. My Contribution by AnalogDiehard · · Score: 2, Funny

    I submitted a M$ Windows XP EULA. The code parser exploded and it was disqualified.

    --
    Eternity: will that be smoking, or non-smoking? I Corinthians 6:9-10
  47. Blame emacs! by Anonymous Coward · · Score: 0

    It's no wonder, they're running it on emacs, clearly. I mean, just look at this comment from one of the hint files:

    The keyboard driver can cope with the basic alpha-numeric keys, but gets confused by fancy things like 'shift' or 'backspace'.

    In the text-file viewer, 'vi', the up/down and pgup/pgdn keys scroll up or down by one line. There is nothing to stop you [from] scrolling above the top of the file, and pressing any other keys may have an undefined effect.


    Damned emacs zealots ;-)

  48. Re:Winner by Anonymous Coward · · Score: 0

    O/T, but a good one from the Edinburgh fringe this year:

    "'Employee of the month" - a winner & a loser at the same time.

  49. Re: #define tricks are usless for obfuscation by Anonymous Coward · · Score: 1, Interesting
    step 1: cpp -E -nostdinc unreadable.c | grep -v '^#' | indent > readable.c
    step 2: ?
    step 3: profit!

    This method also works on lame tricks like:
    a;bunch;of;stuff;x\
    x = 3;
  50. Not the best possible tutorial.. by Anonymous Coward · · Score: 0

    First, it isn't much of an obfuscation. This is all so obvious stuff that I'd actually avoid doing delibarately any of it on ioc^3.
    Second, to me, the end result actually looks more terse and elegant than the original crap with its single-exit dogma, hungarian notation and heretic bracing :)
    Third, in fact the original is not even C (void main)
    Finally, the author actually hasn't bothered to compile his creation as he has made at least one serious mistake in the process that ought to stop any decent compiler ((iter=1)-- instead of (iter=1)-1).

  51. nethack/vi keys for arachnid by lilmouse · · Score: 1

    Yay! I understood the code enough to change the movement keys to vi/nethack standard!

    --LWM

    1. Re:nethack/vi keys for arachnid by multipartmixed · · Score: 1

      That's nothing, I've already got it running in a 3D rendered OpenGL environment.

      --

      Do daemons dream of electric sleep()?
    2. Re:nethack/vi keys for arachnid by lilmouse · · Score: 1

      Does it still use its own sourcecode as a good default maze?

      --LWM

  52. [OT] Your sig by Anonymous Coward · · Score: 0
    Emacs isn't the best feature-complete text editor... it's the *only* feature-complete text editor.


    Being the only "something" automatically makes it the best (and also the worst). HTH & HAND.