• Anonymous (unregistered)

    Oh god why

  • Steve (unregistered)

    !clever

  • Anon (unregistered)

    trueandorfalse? WTF #1 is not knowing the ! operator. WTF #2 is not knowing that the logical operation you are doing is called "not". WTF #3 is not handling FILE_NOT_FOUND.

  • Anonymous (unregistered)

    Why is it called trueandorfalse() ?

  • eViLegion (unregistered) in reply to Anonymous
    Anonymous:
    Why is it called trueandorfalse() ?
    Because you can put True &/ False in as the input, and you'll get True &/ False as the output, presumably.

    This is one of the best things I've ever seen.

  • Ben (unregistered)

    A real coder would have done:

    return xor(_booInpt,1);

    Obvious really...

  • SurfMan (unregistered)

    At least it's well documented, and even has a touch of humor (Scientology wtf?)

  • (cs)

    This comment is clever... NOT!

  • highphilosopher (unregistered)

    reminds me of a

    if((!shouldContinue) == false) {

    // blah....

    }

    I saw one time. Suddenly the death penalty seems sort of reasonable in extreme situations.

  • (cs)

    The fool! He needs another if!

    ///

    /// Turns true into false and false into true /// -- similar to the church of scientology. /// <param name="_booInpt">True of false</param> /// <returns>False or true</returns> private bool trueandorfalse(bool _booInpt) { // I'm quite sure though there is a very // clever C# standard command doing this, // I just can't find it right now ... if (_booInpt == true) return false; if (_booInpt == false) return true; }

    Looks like I caught this one just in time! :)

  • Lisa McPherson (unregistered) in reply to Anon
    WTF:
    /// -- similar to the church of scientology.
    The Church of Scientology is a very dangerous organization.

    http://en.wikipedia.org/wiki/Lisa_mcpherson

    http://en.wikipedia.org/wiki/Operation_Freakout

    http://en.wikipedia.org/wiki/Operation_Snow_White

    Be very careful how you decide to engage them.

  • flyboyfred (unregistered) in reply to Steve
    Steve:
    !clever

    I think you mean, "trueandorfalse(clever)".

  • D (unregistered) in reply to T $
    T $:
    The fool! He needs another if!

    ///

    /// Turns true into false and false into true /// -- similar to the church of scientology. /// <param name="_booInpt">True of false</param> /// <returns>False or true</returns> private bool trueandorfalse(bool _booInpt) { // I'm quite sure though there is a very // clever C# standard command doing this, // I just can't find it right now ... if (_booInpt == true) return false; if (_booInpt == false) return true; }

    Looks like I caught this one just in time! :)

    LMAO greatest comment ever

  • Buddy (unregistered)
    // converts true to false and false to true
    // extra ! are to make sure it's absolutely, positively,
    // unambiguously, categorically, unconditionally, decidedly,
    // unquestionably and definitely inverted
    bool invert(bool b)
    {
        return !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!b;
    }
    

    Extra credit to those who actually counted!

  • (cs)

    What about FILE_NOT_FOUND?

  • (cs)

    This suit is black not.

  • OutlawProgrammer (unregistered)

    TRWTF is Microsoft thinking that using XML for comments was a good idea.

  • (cs) in reply to T $
    T $:
    The fool! He needs another if!

    Looks like I caught this one just in time! :)

    What if the boolean isn't true or false though?

    /// 
    /// Turns true into false and false into true 
    ///   -- similar to the church of scientology.
    /// <param name="_booInpt">True of false</param>
    /// <returns>False or true</returns>
    private bool trueandorfalse(bool _booInpt)
    {
        // I'm quite sure though there is a very 
        // clever C# standard command doing this, 
        // I just can't find it right now ...
        if (_booInpt == true)
            return false;
        if (_booInpt == false)
            return true;
        return FILE_FOUND_SEVERAL_TIMES
    }
    
  • (cs) in reply to Buddy
    Buddy:
    // converts true to false and false to true
    // extra ! are to make sure it's absolutely, positively,
    // unambiguously, categorically, unconditionally, decidedly,
    // unquestionably and definitely inverted
    bool invert(bool b)
    {
        return !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!b;
    }
    
    Extra credit to those who actually counted!

    Thank goodness someone knows that you have to make sure the computer really gets it. But just to make sure, you should return it again, in case the computer missed the return statement the first time.

    :)

    Also... 47. Extra credit

  • KD (unregistered)

    The real WTF is when a decent compiler doesn't turn this method call into a simple ! operation.

  • Shredder (unregistered)

    XML is a good idea for EVERYTHING.

  • Rodnas (unregistered) in reply to db2
    db2:
    This suit is black not.

    It is great joke. I like. Tjenkoeje.

  • (cs)

    trueandorfalse(its) only that the coder trueandorfalse(does) know the basic operands, but he also feels he trueandorfalse(could) be bothered to look for them at the moment.

    but he is somehow capable of endless trueandorfalse(wit) in his comments.

  • (cs)

    Countdown to Alex being sued, murdered, or falsely discredited for being a sexual deviant:

    10:01:59... 10:01:58... 10:01:57... 10:01:56...

  • (cs)

    The lawyers at the Church of Scientology have been notified and will sue the pants off of Alex, the original author of this posting, and the original author of the code.

    Addendum (2009-10-07 11:21): The lawyers at the Church of Scientology have been notified and will sue the pants off of Alex, the original author of this posting, and the original author of the code. Katie Holmes will represent the church in court and will appoint Tom Cruise as the judge. If you accuse them of bias by attempting to appoint a fellow follower as the judge, they shall sue you a second time.

  • Wheaties (unregistered) in reply to NightDweller

    I've seen this before unfortunately. Only it's been 1 to 0 and 0 to 1 instead of using the built in boolean of the language.

  • trueandorfalse(nobody) (unregistered) in reply to NightDweller
    NightDweller:
    trueandorfalse(its) only that the coder trueandorfalse(does) know the basic operands, but he also feels he trueandorfalse(could) be bothered to look for them at the moment.

    but he is somehow capable of endless trueandorfalse(wit) in his comments.

    Maybe he DID look for some built-in operator for the "andor" operation, but didn't find anything...

  • (cs)

    What is the "true of false"? Is there truth in falsehood?

  • Tom Cruise (unregistered) in reply to SurfMan
    SurfMan:
    At least it's well documented, and even has a touch of humor (Scientology wtf?)
    I'm a Scientologist, you insensitive clod!
  • (cs) in reply to Wheaties
    Wheaties:
    I've seen this before unfortunately. Only it's been 1 to 0 and 0 to 1 instead of using the built in boolean of the language.
    And even then, trivial to invert with "value = 1 - value". You used to see that a lot in old BASIC programs.
  • lawlsci (unregistered) in reply to Tom Cruise
    Tom Cruise:
    SurfMan:
    At least it's well documented, and even has a touch of humor (Scientology wtf?)
    I'm a Scientologist, you insensitive clod!

    Calm down, don't go all Sci-Fi on him!

  • Galvanick Lucipher (unregistered)

    GREATEST. WTF. EVER.

  • !? (unregistered) in reply to Ben
    Ben:
    A real coder would have done:

    return xor(_booInpt,1);

    Obvious really...

    !!!

  • Anon (unregistered) in reply to NightDweller
    NightDweller:
    trueandorfalse(its) only that the coder trueandorfalse(does) know the basic operands, but he also feels he trueandorfalse(could) be bothered to look for them at the moment.

    but he is somehow capable of endless trueandorfalse(wit) in his comments.

    You fail on your last use of trueandorfalse.

    wit not? not wit? trueandorfalse(does) make sense.

  • (cs) in reply to SarahE
    SarahE:
    But just to make sure, you should return it again, in case the computer missed the return statement the first time.

    Like this?

    bool invert(bool b)
    {
        while (true)
        {
            return !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!b;
        }
    }

    Now, about the halting problem...

  • silent d (unregistered) in reply to lawlsci

    From now on, I'm outsourcing all my development work to the Church of Scientology. I mean, at least they admit their Book was written by a science fiction author.

  • (cs)
    highphilosopher:
    reminds me of a

    if((!shouldContinue) == false) {

    // blah....

    }

    I saw one time. Suddenly the death penalty seems sort of reasonable in extreme situations.

    I have seen worse:

    if((!notShouldContinue) == false)

    Good luck.

  • !? (unregistered) in reply to T $
    T $:
    The fool! He needs another if!

    ///

    /// Turns true into false and false into true /// -- similar to the church of scientology. /// <param name="_booInpt">True of false</param> /// <returns>False or true</returns> private bool trueandorfalse(bool _booInpt) { // I'm quite sure though there is a very // clever C# standard command doing this, // I just can't find it right now ... if (_booInpt == true) return false; if (_booInpt == false) return true; }

    Looks like I caught this one just in time! :)

    I hope you are joking.

    ... couldn't resist. CAPTCHA: secundum. !primum

  • (cs) in reply to Steve
    Steve:
    !clever
    QFT.

    Fired.

  • The Sussman (unregistered)

    FRIST

  • hajo (unregistered)

    I'm quite sure there is a very clever post commenting this, I just can't find it right now ...

  • (cs) in reply to Anon
    Anon:
    NightDweller:
    trueandorfalse(its) only that the coder trueandorfalse(does) know the basic operands, but he also feels he trueandorfalse(could) be bothered to look for them at the moment.

    but he is somehow capable of endless trueandorfalse(wit) in his comments.

    You fail on your last use of trueandorfalse.

    wit not? not wit? trueandorfalse(does) make sense.

    That one was intended as a "...endless wit (not!) .." sort of thing.

  • NotNotWhat (unregistered) in reply to derula
    derula:
    SarahE:
    But just to make sure, you should return it again, in case the computer missed the return statement the first time.

    Naaa, I think like this:

    bool invert(bool b)
    {
        while ( invert(false) )
        {
            return !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!b;
        }
    }

    Now, about the halting problem...

  • ClutchDude (unregistered)

    The googles....they do nothing!

    Captcha: plaga... like the RE:4&5 plot device.

  • martiert (unregistered) in reply to T $

    Yeah. Only problem is that the compiler won't like this since you use an if instead of an else. So it might get to the end of the function without returning anything. Solution: throw an exception!

  • C (unregistered) in reply to !?
    !?:
    T $:
    The fool! He needs another if!

    (code snipped)

    Looks like I caught this one just in time! :)

    I hope you are joking.

    ... couldn't resist. CAPTCHA: secundum. !primum

    Of course he is. That code wouldn't even compile, the stupid compiler complains that not all code paths return a value... 8-|

  • Jay (unregistered)

    I have frequently seen code that is clearing trying to initialize a flag that looks like this:

    if (flag==true) flag=false;

    I've seen this from multiple programmers at different companies, like they must either teach this in school somewhere or it's a common form of mental illness. What, you think that it will take the computer longer to set the flag to false when it's already false then it would to first check if it's true? Actually the reverse is almost certainly the case. Or are you just being careful not to set it to false when it's currently FILE_NOT_FOUND?

    Ditto on:

    if (amount1!=0) total=total+amount1;

    Yeah, we want to save the computer from having to add the two numbers together if one of them is zero. Except, the "if" almost surely takes longer than the plus, so if it's not zero, the "if" is completely superfluous wasted time, and if it is zero, you've still taken longer than just adding it in.

  • grg (unregistered)

    Well, actually, it DOES do something more than the NOT operator (!) does.

    It maps values that are EXACTLY equal to "true" to false, everything else maps to true.

    If we assume that the incoming value might have come from an unsafe source, and might contain any random value, then it does do something slightly different than (!)

    Not that that makes it any better.

  • nitehawk (unregistered)

    If it wasnt for the amusing "similar to the church of scientology" text, I would fire this person on the spot.

  • Neo31337 (unregistered) in reply to highphilosopher
    highphilosopher:
    reminds me of a

    if((!shouldContinue) == false) {

    // blah....

    }

    I saw one time. Suddenly the death penalty seems sort of reasonable in extreme situations.

    LOL! I haven't laughed this hard in a long time.

Leave a comment on “The Clever Coder”

Log In or post as a guest

Replying to comment #:

« Return to Article