Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Death Of The Obfuscated C Code Contest? 19

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?"
This discussion has been archived. No new comments can be posted.

Death of the Obfuscated C Code Contest?

Comments Filter:
  • by Anonymous Coward
    main() {double a,b,c;if(a,b,c,1){printf("frist psot\n");}}
  • by h2odragon ( 6908 ) on Tuesday October 10, 2000 @04:47PM (#716270) Homepage
    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".

  • 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.
  • by Anonymous Coward
    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.
  • by Anonymous Coward
    now that C# has been announced.
  • by fwc ( 168330 )
    Who would want to write Obfuscated C when they can write Obfuscated Perl? [itknowledge.com]

    Or Even better.... Perl Poetry. [itknowledge.com]

  • 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
  • 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.
  • Wouldn't that be e=d modulo a.
  • you missed the comma operator between the printf and e=d%a, which evaluates the printf, but has the value e=d%a.
  • 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.

  • by catseye_95051 ( 102231 ) on Wednesday October 11, 2000 @11:09PM (#716280)


    *** 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.
  • 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...
    • 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

  • 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.

  • 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.
  • 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.
  • >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.
  • 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.

We are each entitled to our own opinion, but no one is entitled to his own facts. -- Patrick Moynihan

Working...