• Chris B (unregistered)

    TRWTF is not the code -- it's that it was able to be committed

  • Manic Mailman (unregistered) in reply to Nutmeg Programmer
    Nutmeg Programmer:
    Do I understand that this program, whatever it is, gave wrong answers for 2+ years before anyone looked for a bug?

    And those wrong answers would have been more than just inaccurate - there would have been letters used for some of the digits. If those kinds of bugs can go unchecked for so long, I wonder how much more WTF-ery is at that place.

  • Mr.'; Drop Database -- (unregistered) in reply to Vollhorst
    Vollhorst:
    Well, found a nice function in the code I currently work with:

    bool IsNegative(double value);

    I bet you can image how the body of that function looks.

    Oh, is it this?
    bool IsNegative(double value)
    {
    unsigned char* omglol = reinterpret_cast<unsigned char*>(&value) + 7;
    return (*omglol & 128) == 128;
    }

  • (cs) in reply to NaN
    NaN:
    Ah. An Honest WTF that is the real WTF.

    Also, I like the AD at the top of the page: Non-WTF Job: Want a 30 inch monitor? Work for TripAdvisor (Newton, MA)

    Are we that easily swayed? COURSE NOT! Make it 32 and you have a deal.

    Can you tell me what are the parameters for the TripAdvisor function?

  • Jon (unregistered) in reply to mrprogguy
    mrprogguy:
    itoa() and ltoa() are non-standard library functions, and that is a real WTF. For portability reasons they shouldn't be used, as not all compilers support them.
    Use itoa, and if you ever need to compile it on a compiler that doesn't have it, provide the definition then. You can even use #ifdef to allow the same code to compile on the different compilers. Or were you being sarcastic?
  • Me (unregistered) in reply to ParkinT

    i got 2 32 inches monitors :P

  • fred (unregistered)

    I don't quite grok this WTF:

    By using atoi with the wrong base, users had numerical results that contained letters and didn't complain ? And the sofware went throught several revisions, with more and more letter cropping into results (at the end, almost 25% of the numerical symbols would be letters).

    Now, if we were talking about itoa, I would understand that the results would be worse and worse... (ie: 10 in the input beeing replaced by 13, etc, etc)

  • DHager (unregistered) in reply to Anon.

    Ridiculous. Certainly not if Base 13, like Base 16, would use A, B, and C.

    Ahem. In the pattern of high-schoolers everywhere who've learned they can turn their calculators upside-down...

    B00B135!

  • Jon (unregistered) in reply to Me
    Me:
    i got 2 32 inches monitors :P
    I've seen 80-inch monitors. I've even hand-fed some of the ones that live near my coast house.
  • DavidTC (unregistered)

    There are many things often change that should be configuration options.

    There are many things that rarely change that should be in global headers.

    Then there are things that do not change, like the frickin base the entire world operates in. The world will not be moving to base 12 or base 60 anytime soon. Anyone who thinks 'the base we operate in' shouldn't be a 'magic number' is insane.

    But, seriously, this was actually pretty much has to have been a stupid search and replace. Although the sort of idiot would search and replace '10' is unknown, nor what other horrible things that resulted in. (They probably had to manually fix all the ones that wouldn't compile.) Someone should probably search for 'VERSION_CODE' and check each use of it.

    Also, the fact this wasn't caught immediately in 2006 does not bode well for quality control.

  • BillyBob (unregistered) in reply to DavidTC

    I'm going to say the WTF here is in the original developer who didn't use a macro for what eventually turned into VERSION_CODE.

    Fixing all the magic numbers, if you have no idea where they all are and there a millions of line of code to inspect, is NOT going to be a fun fix and I can understand that one of these slipped through the net (the function could have been so rarely used and the output deviation so minor that unit testing didn't pick it up. Although, it's hard to defend this slipping through a review).

  • The_Assimilator (unregistered) in reply to fred

    We are talking about

    itoa
    , or does your article read differently to everyone else's?

    On topic, this is a WTF of note. Using a non-standard library function? Check. Using an obscurely-named constant as a parameter to that function? Check. Using zero common sense regarding said constant? Check, check, and check.

  • Pete (unregistered) in reply to Dave
    Dave:
    Did someone notice there was a constant defined as 10

    Nah, I guess at one time they were replacing the literal 10 with VERSION_CODE and didn't check if there were places where the literal were not used in a VERSION_CODE context

  • (cs)

    Perhaps the developers were simply trying to discover the Ultimate Question of Life, The Universe and Everything? (6 * 9 = 42)

  • Anonymous Cow-herd (unregistered) in reply to JimM
    JimM:
    Perhaps the developers were simply trying to discover the Ultimate Question of Life, The Universe and Everything? (6 * 9 = 42)

    I've always said there was something fundamentally wrong with the universe.

  • (cs) in reply to DavidTC
    DavidTC:
    There are many things often change that should be configuration options. But, seriously, this was actually pretty much has to have been a stupid search and replace. Although the sort of idiot would search and replace '10' is unknown, nor what other horrible things that resulted in. (They probably had to manually fix all the ones that wouldn't compile.) Someone should probably search for 'VERSION_CODE' and check each use of it.

    Also, the fact this wasn't caught immediately in 2006 does not bode well for quality control.

    I'm pretty sure that's exactly how it happened but all it would take is the programmer who did the search and replace to not understand itoa and the QA people not understanding it either.

  • NeoMojo (unregistered) in reply to gabba
    gabba:
    "This one goes to base 11"
    "Can't you just fit more numbers into base 10?"
  • John Thomas (unregistered)

    Heck no dude that's insane. No way man.

    JT http://www.Privacy-Center.Net

  • S (unregistered) in reply to #define AUTHOR_NAME 13

    Well played, sir. Well played.

  • (cs) in reply to DHager
    DHager:
    Ahem. In the pattern of high-schoolers everywhere who've learned they can turn their calculators upside-down...

    B00B135!

    Am I too young to know what a seiboob is? On the other hand, five million, three hundred eight thousand, eight makes me giggle.

  • Ipsos (unregistered)

    Isn't the real WTF that it took 3 years for this bug to be fixed? I figure in 2006 when the bug became evident they (the company) would try to track down the issue and fix it.

  • fred (unregistered) in reply to The_Assimilator

    I messed up in the comment. I meany the opposite:

    the code is about itoa (integer to ascii) so they have letters in number and did found that. I don't believe it.

    if the code was about atoi (ascii to integer) then I can understand how the result would be wrong, with "10" beeing intepreted as 13.

  • Lardious (unregistered) in reply to real_aardvark

    Assuming you were being serious...

    "I didn't even know that there was a third parameter to itoa() in the first place. Why?"

    Erm, because who says what text format is the right one for representing a number?

    "Using itoa() at all is a bit of a WTF in itself. It's not like it does anything that sprintf() doesn't do (apart from print numbers in base 13, obviously), and it certainly does a lot less."

    Interesting point; I think you're correct in one way, that itoa() is not standard/portable but sprintf() is. On the other hand atoi() is potentially much faster / less resource hungry (remembers horrible ancient embedded libraries where sprintf() filled up much of the available space) than sprintf(), also sprintf() can't handle all base formats up to 32 (normal upper limit).

  • R (unregistered) in reply to sysKin

    I know you are trying to be funny, but that function is wrong. It would say that -0.0 is not negative, thereby failing the one test that I'm guessing is the point of the whole function...

  • v.dog (unregistered) in reply to #define AUTHOR_NAME 13

    Actually, because you are changing the base, it gets smaller every year. ;)

  • Anonymouse (unregistered)

    Thanks Michael - I had NO idea what this one was on about.

  • k (unregistered)

    Could the real WTF be that this could have been a malicious attempt by a previous developer who has left/been sacked/etc. to let the product derail itself slowly as time goes by?

    The fact that it went undiscovered for 2 years seems like they didn't care about the quality of the product for a while until someone really complained hard?

  • (cs)

    For those who don't see the WTF: Stop (C/C++) programming. Others should to it for you ;-)

  • R3ap3R (unregistered) in reply to ParkinT
    NaN:
    Mine is already 32 inches!

    {Oh, I have a large monitor too}

    42" FTW. PROOF

  • tanus (unregistered) in reply to James R. Twine

    Dolor: Spanish word for 'pain.' As in: I have a dolor in my tanus.

Leave a comment on “It Gets Worse Each Year”

Log In or post as a guest

Replying to comment #:

« Return to Article