• Richard (unregistered)

    Xkcd is wrong, the unending dullness of the first post is alive and well

    http://m.xkcd.com/1258/

  • EuroGuy (unregistered)
    // there ARE legitimate use cases for goto
    You cannot argue with code comments!
  • CigarDoug (unregistered) in reply to Richard
    Richard:
    Xkcd is wrong, the unending dullness of the first post is alive and well

    http://m.xkcd.com/1258/

    I would rather read five pages of Frist comments than this week's contest. Contrived WTFery is not entertaining; human stupidity occurring naturally in the wild, is.

    CAPTCHA: immitto. immitto make fun of the other tired meme on this forum.

  • (cs)

    Wow, that was painful to read...

    The multiple different spellings of the same word in one function makes me think the author must have worked here at some point...

    // there ARE legitimate use cases for goto goto botched;
    But this REALLY ISN'T one of them. At least a direct "return FALSE;" means you don't have to scroll to the label to find out what actually happens. In fact, those two lines have so many WTFs and meta-WTFs that it's difficult to count them all...
  • QJo (unregistered)

    The real WTF is this: am I right?

    if (CloseHandle(file) == TRUE)
    	{
    		return TRUE;
    }
    

    It's not a good idea to be lax with your indentation style.

    Apart from that, a solid piece of workaday code that I would not be ashamed to read on the screen of one of my members of staff.

  • anon (unregistered) in reply to CigarDoug

    [quote user="CigarDoug"][quote user="Richard"]

    CAPTCHA: immitto. immitto make fun of the other tired meme on this forum.[/quote]

    Other annoying internet behaviors: quoting the captcha - really dumb and just as boring as 'first'.

  • (cs)

    http://thedailywtf.com/Articles/img.thedailywtf.com/images/remy/wrong_tool.zip -> 404 - File or directory not found.

    Dead links make Al Gore cry.

  • Pixie (unregistered)

    URGENT Can someone email me the vb version please

  • (cs)

    Now I'm depressed because this code is freakishly similar to stuff I wrote when I was teaching myself C back in middle school[*].

    And I thought I was sooooooo smart back then....

    [*] Back in the age of dinosaurs when you actually had to buy C compilers and the price was about half of your summer job wages.

  • O. Contraire (unregistered)

    The real WTF is PL/SQL?

    I guess I can understand who somebody who deals with T-SQL could come up with that notion. After all, who needs parameterized cursors, nested procedures, package state, etc. when you can play with magic combinations of at-signs?

    Captcha: appellatio -- a self-referencing mountainous region.

  • (cs)
    We were humbled by the effort that went into authoring thousands of lines of code piled high with anti-patterns and terrible naming conventions.

    I may not have won, but I'll consider this as my honorable mention! (I'm assuming nobody else wrote thousands of lines, but this is TDWTF so who knows.)

  • OracleIsTheRealWTF (unregistered) in reply to O. Contraire
    O. Contraire:
    The real WTF is PL/SQL?

    I guess I can understand who somebody who deals with T-SQL could come up with that notion. After all, who needs parameterized cursors, nested procedures, package state, etc. when you can play with magic combinations of at-signs?

    Captcha: appellatio -- a self-referencing mountainous region.

    Because let's make a set theory based database engine but then create PL/SQL so that everyone uses cursors and RBAR processing and turning set theory into cobol.

    captcha: paratus. Instead of eating the pear, the paratus.

  • asdf (unregistered) in reply to CigarDoug
    CigarDoug:
    Richard:
    Xkcd is wrong, the unending dullness of the first post is alive and well

    http://m.xkcd.com/1258/

    I would rather read five pages of Frist comments than this week's contest. Contrived WTFery is not entertaining; human stupidity occurring naturally in the wild, is.

    CAPTCHA: immitto. immitto make fun of the other tired meme on this forum.

    I agree, this week was lame

  • Krunt (unregistered) in reply to O. Contraire
    O. Contraire:
    Captcha: appellatio -- a self-referencing mountainous region.

    I thought appellatio was performing oral sex on a fruit?

  • cappy (unregistered) in reply to Pixie
    Pixie:
    URGENT Can someone email me the vb version please
    Never mind vb, I'm hoping someone ports it to C# so we can implement this at work! Hmmm, where's Nagesh?! I'll outsource the translation to his team!
  • O. Contraire (unregistered) in reply to OracleIsTheRealWTF

    Quite. Because the relational model describes the transition between valid states, right?

    Captcha: populus; take it out of Senatus Populusque Romanum, and you have SQR, a reporting language now owned by Oracle. (Of course, then what do you need the "que" for?)

  • (cs) in reply to OracleIsTheRealWTF
    OracleIsTheRealWTF:
    O. Contraire:
    The real WTF is PL/SQL?

    I guess I can understand who somebody who deals with T-SQL could come up with that notion. After all, who needs parameterized cursors, nested procedures, package state, etc. when you can play with magic combinations of at-signs?

    Captcha: appellatio -- a self-referencing mountainous region.

    Because let's make a set theory based database engine but then create PL/SQL so that everyone uses cursors and RBAR processing and turning set theory into cobol.

    captcha: paratus. Instead of eating the pear, the paratus.

    Also: Separation of concerns is for losers. Business logic should intermingle freely with data layer queries and, if you have the pleasure of using Oracle Forms, both should intermingle with presentation layer GUI.

    Captcha: None, suckers!

  • Anon') OR 1=1; -- (unregistered)

    TRWTF:

        if (HANDLE file = CreateFile(folder2, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))

    CreateFile() returns INVALID_HANDLE_VALUE (aka -1), not NULL, when it fails. So this if statement will always succeed.

  • foo (unregistered)

    Congratulations, Mr. W., youre a well deserved winner!

    You're software engineering skillset betrays not only youre ability to design problem specific framework builders and mastery of modern C++ features such as auto. You also demonstrate understanding of criptological fundamentals ie. decription must always be simmetric (= opposite) to encription, very good indeed:

    Encript:

    return lData ^ CRYPTOKEY;
    Decript:
    return CRYPTOKEY ^ lData;

    So I'd like to offer you a job in our development team. (Well, I'd like to, but the job has already been promised to the president's nephew.)

  • foo (unregistered) in reply to anon

    [quote user="anon"][quote user="CigarDoug"][quote user="Richard"]

    CAPTCHA: immitto. immitto make fun of the other tired meme on this forum.[/quote]

    Other annoying internet behaviors: quoting the captcha - really dumb and just as boring as 'first'.[/quote]Other annoying internet behaviors: Messing up the quote tags.

    Just kidding, of course, TRWTF is a web site that allows that.

    (And yes, I know this one will also be messed up as I'm intentionally not fixing the quotes.)

    CAPTCHA: verto = frist!

  • foo (unregistered)

    Right or wrong, that's how Boolean decision have always been made!

  • That_PLSQL_Guy (unregistered)

    Developer of the runner up here.

    This is a working link to the code for anyone interested:

    http://app6.websitetonight.com/projects/2/5/7/2/2572583/uploads/wrong_tool.zip

  • Gary (unregistered) in reply to O. Contraire
    O. Contraire:
    Quite. Because the relational model describes the transition between valid states, right?

    Captcha: populus; take it out of Senatus Populusque Romanum, and you have SQR, a reporting language now owned by Oracle. (Of course, then what do you need the "que" for?)

    [image]

  • Matteo (unregistered) in reply to asdf

    A lot of people have complained about a week's worth of contest entries. Just to present an opposing view, I kind of liked them. Sure, they're not as brillant as Paula Bean, but I got a kick out of 'em.

    Cheers

  • Krunt (unregistered) in reply to Matteo
    Matteo:
    A lot of people have complained about a week's worth of contest entries. Just to present an opposing view, I kind of liked them. Sure, they're not as brillant as Paula Bean, but I got a kick out of 'em.

    Cheers

    Haha, Paula Bean?

    Was she fired as a DBA for her mis-use of the term "Trigger" ?

  • That_PLSQL_Guy (unregistered) in reply to mikeTheLiar

    Developer of the runner up here.

    This is a working link to the code for anyone interested:

    http://app6.websitetonight.com/projects/2/5/7/2/2572583/uploads/wrong_tool.zip

  • nogood boyo (unregistered)

    Not bad, but of course not even in the ballpark of the best entries from the International Obfuscated C Contests from years gone by.

    I was particularly disappointed by the lack of nested ternary operators, something that has appeared without fail in every bit of real life loony C++ code I've had the misfortune to have to work with.

  • sqlblindman (unregistered) in reply to O. Contraire
    O. Contraire:
    The real WTF is PL/SQL?

    I guess I can understand who somebody who deals with T-SQL could come up with that notion. After all, who needs parameterized cursors, nested procedures, package state, etc. when you can play with magic combinations of at-signs?

    Captcha: appellatio -- a self-referencing mountainous region.

    LOL. Leave it to an Oracle coder to assert that cursors are a good thing...

  • n_slash_a (unregistered)

    TRWTF here is

    #define CRYPTOKEY 7
    When everyone knows that the real random number is 4 :: http://xkcd.com/221/

    CAPTCHA immitto

  • Joe (unregistered)

    I'm surprised no one jumped in the 'auto' / garbage collector comments. Those made me wince in a special way, and then want to go all Zorbo, shouting "It does not work that way!"

    [ http://i1.ytimg.com/vi/ZQg8JKo_3ZQ/hqdefault.jpg ]

  • Anonypony (unregistered)
    // you casn't protect all your date form every hackyer, but you might as well slow them down a little
    	return lData ^ CRYPTOKEY;

    Nagesh! You won! I'll buy you a nice big steak next time I'm in Hyderabad.

  • foo (unregistered) in reply to Joe
    Joe:
    I'm surprised no one jumped in the 'auto' / garbage collector comments.
    Surprised indeed (#416063).
  • foo (unregistered) in reply to n_slash_a
    n_slash_a:
    TRWTF here is
    #define CRYPTOKEY 7
    When everyone knows that the real random number is 4 :: http://xkcd.com/221/

    CAPTCHA immitto

    That's so random 1.0. Haven't you upgraded yet? We're at 9 already.

  • foo (unregistered) in reply to EuroGuy
    EuroGuy:
    // there ARE legitimate use cases for goto
    You cannot argue with code comments!
    // goto hell
  • (cs)
    copy of Visual Studio 2012 Express, and a complete ignorance of source control, he will take on the world of shareware decision-making applications written in MFC.

    Sorry to be boring, but there is not MFC in the Express edition. (If that was a joke, than sorry for my ignorance.)

  • Norman Diamond (unregistered) in reply to Anon') OR 1=1; --
    Anon') OR 1=1; --:
    TRWTF:
        if (HANDLE file = CreateFile(folder2, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
    CreateFile() returns INVALID_HANDLE_VALUE (aka -1), not NULL, when it fails. So this if statement will always succeed.
    If you read carefully, you'll notice that's not the only TRWTF in the winning WTF submission.

    However, it's not even always true. The first time CreateFile() failed for me, it returned NULL. Later someone told me that only happens in Windows 98 when failing to open certain kinds of devices. So it's a coincidence that the first time CreateFile() failed for me, it was when trying to open COM1: when another program already had COM1: open. For a few years after that, I tested the result of CreateFile() against both INVALID_HANDLE_VALUE and NULL.

    Then I learned that sometimes CreateFile() can return NULL when it succeeds, because NULL is a valid handle value. Next I learned that that's only true for some kinds of handles, not for other kinds. Have we reached TRWTF yet?

  • Norman Diamond (unregistered) in reply to QJo
    QJo:
    The real WTF is this: am I right?
    if (CloseHandle(file) == TRUE)
    	{
    		return TRUE;
    }
    
    It's not a good idea to be lax with your indentation style.
    If you read carefully, that's not the only TRWTF in the winning WTF submission.
  • Norman Diamond (unregistered) in reply to nogood boyo
    nogood boyo:
    Not bad, but of course not even in the ballpark of the best entries from the International Obfuscated C Contests from years gone by.
    I thought IOCCC was intended to show that C is a WTF language, which is a considerably different goal from the OMGWTF contests.
    nogood boyo:
    I was particularly disappointed by the lack of nested ternary operators, something that has appeared without fail in every bit of real life loony C++ code I've had the misfortune to have to work with.
    Oh gee thanks. Two days ago I had to rehack a hacked macro and increase the nesting of ternary operators ... in some encryption code, no less. After hosing down my keyboard and blowtorching my monitor, I was able to forget about it. Now you had to go and remind me. A plaga upon you.
  • (cs) in reply to CigarDoug
    CigarDoug:
    I would rather read five pages of Frist comments than this week's contest. Contrived WTFery is not entertaining; human stupidity occurring naturally in the wild, is.

    I just can't agree. If we can have the Outrageous Human Powered Flying Machines Competition, why not a competition where people imitate the worst of the worst WTF's?

    I face-palmed at least 5 times for the grand prize winner.

    Oh, Askimet, you are such a pain. I am not at all suggesting anyone should acquire anything related to that there humor fest.

  • Nico... (unregistered) in reply to Pixie

    sure, what is your fax number ?

  • foo (unregistered) in reply to Nico...
    Nico...:
    sure, what is your fax number ?
    Didn't you get my owl?
  • R (unregistered)

    Gotta love C++ Garbage Collection!

    Really surprised 'auto' wasn't called out. That code was leaking all over the place.

    http://msdn.microsoft.com/en-us/library/6k3ybftz(v=vs.90).aspx

  • Norman Diamond (unregistered) in reply to R
    R:
    Really surprised 'auto' wasn't called out.
    I'm surprised too. So were these other commenters:
    foo:
    Congratulations, Mr. W., youre a well deserved winner!

    You're software engineering skillset betrays not only youre ability to design problem specific framework builders and mastery of modern C++ features such as auto.

    foo:
    Joe:
    I'm surprised no one jumped in the 'auto' / garbage collector comments.
    Surprised indeed (#416063).
    If you read before posting, you'll be surprised too.

  • (cs)

    I like the meta-wtf of the 'auto' storage class/type specifier: in C, auto is just the default storage class for local scope variables, so even though he doesn't need to explicitly write it (nor is it a 'life saver') he isn't all wrong about it... except when he writes "auto someVariable = new someClass()" in that case the auto storage class can't be used of course, since the 'new' keyword allocates memory on the heap. Instead, if he's using a cpp compiler that supports c++11, auto will be used as a compile-time type specifier, which is a bit of a cpp wtf (not because of what it does, but because it re-uses a C keyword for an entirely different purpose). Kudos for creating a memory leak that is somewhat tough to find and requires historical research to be sure of!

  • Chris W. (unregistered)

    I suppose I should have come out of the woodworks earlier with this, but I only just remembered that this post didn't have a link to the "code."

    I've pushed my entry to GitHub:

    https://github.com/cawagner/omgwtf2

    I submitted it as just a .zip on a random server, because I felt that using source control even vaguely correctly at any point in the development / submission process would ruin the effect. As a bonus to that approach, Chrome gave a warning that the file was "not often downloaded and could be dangerous." Thankfully, that warning was ignored.

    That MFC isn't available in VS2012 Express was unfortunately not an intentional WTF, but I think that given the nature of Mike's enterprise, "Express" is probably just a euphemism for "downloaded off Limewire" anyway.

Leave a comment on “OMGWTF2: The Grand Prize”

Log In or post as a guest

Replying to comment #:

« Return to Article