Slashdot Mirror


Death Of The Obfuscated C Code Contest?

slashdot-me asks: "The International Obfuscated C Code Contest that we all know and love seems to be stalled. The judging phase of the contest began six months ago in April. Since then all the judges except Leonid Broukis have abandoned the project. Has this 16-year-old programming tradition died?"

19 comments

  1. Yes indeed by Anonymous Coward · · Score: 2

    main() {double a,b,c;if(a,b,c,1){printf("frist psot\n");}}

  2. realization dawns by h2odragon · · Score: 3

    While they've been having their merry contests, the rest of the world has utterly failed to learn the lesson they were trying to promote and now calls what they do "programming".

    1. Re:realization dawns by catseye_95051 · · Score: 3



      *** Okay, a warning. This is an opinion some may find distateful. I respect that. Its my opinion. You are free to differ with it ***

      Some still call it programming...

      Others learned the lesson.. and went away to write less obfuscated languages.

      The problem was never the coders... the best coders write clean and readbale code in anything up to and including assembler.

      The problem was that C made it WORK to write such code (much as assembler does) and so the lazier or less disciplined coders didn't write their code that way.

  3. my late entry by crovax · · Score: 1

    I will give 10 karma to whomever can tell me exactly how this code works.

    #include
    int a=10000,b,c=2800,d,e,f[2801],g;
    void main(){
    for(;b-c;)
    f[b++]=a/5;
    for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)
    for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b)
    ;
    }

    Think I could have be a contender?
    -----
    If my facts are wrong then tell me. I don't mind.

    1. Re:my late entry by Anonymous Coward · · Score: 1

      The way that the code works: very badly

      Reasons: first of all, when you tried to include stdio.h, slashdot seems to have filtered out the file name, thinking it was supposed to be an unapproved HTML tag.

      Secondly, main() needs return type int, at least if you're compiling on gcc.

    2. Re:my late entry by ptbrown · · Score: 1

      Just guessing here, but it looks to me like it'll crap out at "f[b++]=a/5;" since you don't assign a value to b.

      Obfuscated C is either a)redundant b)C++ or c)MS Visual C

      --
      Any sufficiently advanced civilization is indistinguishable from Gods.
    3. Re:my late entry by luckykaa · · Score: 1

      Not sure if its in the C specification (And K&R is on the opposite side of the room, so I'm too lazy to look), but since b is global, it will quite likely be initialised to zero.

    4. Re:my late entry by dmp · · Score: 1

      Wouldn't that be e=d modulo a.

      --
      Stop talking about who's to blame when all that counts is how to change --"Born of Frustration" - James
    5. Re:my late entry by bmckeever · · Score: 1

      you missed the comma operator between the printf and e=d%a, which evaluates the printf, but has the value e=d%a.

      --
      Your favorite .sig sucks
    6. Re:my late entry by vrt3 · · Score: 1
      Not declaring a return type for main() is a member of the first group, since exit codes can be awfully useful in a Unix environment... But a typeless main should default to int.

      In C, not declaring a return type for a function is the same (but more clear) as declaring it as an int; that's not the problem. The problem is that you effectively have to return something, which doesn't happen here, otherwise it's not legal C. But it's quite possible gcc will just issue a warning and then happily continues to compile. I don't remember if gcc issues a warning or an error, I haven't tried to forget the return lately.

      --
      This sig under construction. Please check back later.
    7. Re:my late entry by Chris+Hind · · Score: 1

      OK, it's been ages now...will you give us a hint? The major problem I have is that I don't know many algorithms for calculating pi, so I'm kinda stuck before I've got off the ground...

      --
      nal 11
    8. Re:my late entry by JordanH · · Score: 1
      • In C, not declaring a return type for a function is the same (but more clear) as declaring it as an int; that's not the problem.

      Not in C9X. It's one of the changes.


      -Jordan Henderson

    9. Re:my late entry by Alioth · · Score: 1
      since you don't assign a value to b.

      On a Windoze NT system, if you declare a variable but don't initialize it, it's often set to 0xAAAAAAAA (in the case of an int - yes, 32 bits, at least on WinNT). Or -1431655766 if you prefer.

      But if you declare it globally, it's initialized to zero.

  4. There didn't seem to be a point... by Anonymous Coward · · Score: 2

    now that C# has been announced.

  5. Perl by fwc · · Score: 1
    Who would want to write Obfuscated C when they can write Obfuscated Perl?

    Or Even better.... Perl Poetry.

  6. Re:Couldn't be Obfuscated Apathy, could it? by Zvp · · Score: 1

    Check out some of the winners, they are quite impressive. Where else can you find code for a flight simulator that looks like a plane?

    http://www.ioccc.org/years.html#1998
    http://www.ioccc.org/1998/banks.c
    http://www.ioccc.org/1998/banks.hint

    Last time I tried, it wouldn't compile, but I guess you can't expect too much portability from something like this.

  7. Your code does not work. by Tom7 · · Score: 1

    You don't initialize b before using it in the condition of the for loop. An ANSI "main" must have return type int.

    Also, you didn't write this code.

    1. Re:Your code does not work. by schnitzi · · Score: 1

      >You don't initialize b before using it in the condition of the for loop. Ah, but a variable declared globally will be initialized to zero. >An ANSI "main" must have return type int. I don't believe the IOCCC requires ANSI. I know many winning submissions have not done this.

      --



      I object to that article, and to the next reply.
  8. Rumors of IOCCC death may have been premature by schnitzi · · Score: 1

    From the IOCCC page (www.ioccc.org): What's New? 13 Oct 2000: Good news! The main judge (Landon Curt Noll) is back! We hope that the judging will go faster now. I suspect the number of entries each year is growing exponentially. Patience, folks! There's a big workload, and the judges are doing on a strictly voluntary basis.

    --



    I object to that article, and to the next reply.