• that other guy (unregistered)


  • Terion (unregistered)

    This seems like an obfuscated version of: #define FALSE TRUE

  • Vilx- (unregistered)

    Thrid, but at least it's here: CONDITION_FILE_NOT_FOUND

  • (nodebb)

    To everything (tern tern tern) There is a season (tern tern tern) And a time to every purpose, under Heaven -- The Byrds, "Tern! Tern! Tern! (To Everything There Is A Season"

    Clearly, the Byrds were IT soothsayers... :)

    Addendum 2019-05-21 07:48: (formatting got messed up. fie!)

  • Little Bobby Tables (unregistered)

    I am a meticulous man.

    When throwing rocks at seabirds

    I leave no tern unstoned.

  • JG (unregistered) in reply to Terion

    Actually this is return true or return more true

  • (nodebb) in reply to JG

    Actually this is return true or return more true


  • airdrik (unregistered)

    The true path to success: treat every failure like another success (at the very least the arrogance will irritate and frustrate your foes)

  • Jaloopa (unregistered)

    SMug .net developer checking in to say this would never happen in C# because it handles booleans sensibly

  • (nodebb)

    TRWTF is functions that return bool for success/failure. It's TRWTF because some people use true for success, and some people use false for success, and some, who are themselves TRWTF, use true sometimes and false other times.

  • (nodebb)

    "Isn't that just the wrong way?"

    "Yes, but /faster/!"

  • (nodebb) in reply to Little Bobby Tables

    You are a mean bird-hater. When I leave no tern unstoned, it's because we were all sharing mushrooms.

  • Rob (unregistered)

    Just a guess- could it be that 0 or 1 requires only 1 bit, but a 2 requires 2 bits? (a 1-bit overflow...)

  • Little Bobby Tables (unregistered) in reply to cellocgw

    I am also a conscientious man

    When painting the arses of monkeys at the zoo

    I leave no stern untoned.

  • anonymous (unregistered)

    So where's the punchline? What compiler flags caused the failure? Why/how did they cause it to fail?

    Obviously this code is wrong but presumably it happened to work until a particular compiler flag was enabled or disabled which changed something about how booleans are handled.

  • sizer99 (google) in reply to anonymous

    What compiler flags caused the failure?

    Probably a flag about warnings on implicit casts. That would trigger on trying to return 1 or 2 as bool.

    As a separate comment, if you ever find yourself doing #define RELATED_THINGA 1, #define RELATED_THINGB 2, #define RELATED_THINGC 5, etc., slap yourself and use an enum instead so you can have at least a little bit of type checking.

  • Friedrice the Great (unregistered) in reply to Little Bobby Tables

    You are also a fine maker of puns. I can't compete with you, so I shall pass this tern.

  • gnasher729 (unregistered) in reply to Rob

    In C++, conversion to bool changes zero to false, and anything non-zero to true. So (bool) (condition ? 1 : 2) will always return true, that's how the language is defined.

  • (nodebb) in reply to gnasher729

    This is also the behaviour for C#, unless you have turned off the warnings about implicit conversions, or you set Option Strict On, which prevents implicit conversions.

  • Robert (unregistered)


    It's just a different definition of True and False...

  • Angela Anuszewski (google)

    I got some code today from a vendor and it has a nested ternary. I'm just waiting for the thing to explode.

  • markm (unregistered)

    Is there any language in which casting 2 to boolean would not return true?

  • T.T.O. (unregistered)

    Maybe boolean is also not a boolean, but rather #define bool int.

Leave a comment on “Tern Failure into a Success”

Log In or post as a guest

Replying to comment #:

« Return to Article