• (cs) in reply to lurker
    Anonymous:
    lucky luke:
    Anonymous:
    Anonymous:
    the real WTF is that I am at work today!

    The real WTF is that I'm unemployed and the guys whose code is so horrible that it makes this web site are not.



    hmmm... i wonder why?? maybe if you learned proper grammar you would be employed ;)


    The real WTF?! here is that your grammar is only marginally better.


    yeah, I know... I failed english in high school... twice. That's why i'm a programmer!
    my problem was with this whole part "the guys whose code is so horrible that it makes this web site are not."
    maybe it just needs some punctuation... like:
    the guys, (whose code is so horrible) that it makes this web site, are not.
    now that i can understand. but still the "it" doesn't belong and it should be make, not makes...
    the guys, (whose code is so horrible) that make this website, are not.

    ahh, much better ;)

  • Deparment of Redundancy Department (unregistered)

    Truthiness at its best!

    Everybody knows the correct way to add FileNotFound is by subclassing Bool.  Then you can add other fields, while you're at it.

  • Jon (unregistered) in reply to ParkinT
    ParkinT:

    There are 10 types of people..

    • Those who understand binary
    • Those who don't
    That's not funny, it's just dumb. Go launch yourself into space.

    CAPTCHA = stfu

  • lurker (unregistered) in reply to lucky luke
    lucky luke:
    Anonymous:
    lucky luke:
    Anonymous:
    Anonymous:
    the real WTF is that I am at work today!

    The real WTF is that I'm unemployed and the guys whose code is so horrible that it makes this web site are not.



    hmmm... i wonder why?? maybe if you learned proper grammar you would be employed ;)


    The real WTF?! here is that your grammar is only marginally better.


    yeah, I know... I failed english in high school... twice. That's why i'm a programmer!
    my problem was with this whole part "the guys whose code is so horrible that it makes this web site are not."
    maybe it just needs some punctuation... like:
    the guys, (whose code is so horrible) that it makes this web site, are not.
    now that i can understand. but still the "it" doesn't belong and it should be make, not makes...
    the guys, (whose code is so horrible) that make this website, are not.

    ahh, much better ;)


    The Meta-WTF?! is that people who fail classes in grammar and syntax think that makes them qualified for career in programming.  Programming is all about grammar and syntax, just not the "King's English" kind. 

    captcha: error (almost made me delete my post)

  • John (unregistered) in reply to ammoQ
    ammoQ:
    Anonymous:
    Alex Papadimoulis:

    The problem with "logic" is that it makes things out to be nothing but simple dualities. Proponents of logic want us to believe that everything is true or false, black or white, yes or no, paper or plastic, etc.



    This claim is a minor WTF in itself, since logicians study numerous alternative forms of logic, many of which have more than two truth values (even infinitely many different truth values).


    Hmmm... what is the difference between fuzzy logic and the theory of probability?

    In probability, the cat is alive or dead, with no state in between; while in fuzzy logic, the cat could be very ill, or maybe just have a hairball.

     

  • Alex Corscadden (unregistered) in reply to John
    Anonymous:

    In probability, the cat is alive or dead, with no state in between; while in fuzzy logic, the cat could be very ill, or maybe just have a hairball.



    Or the cat could be trapped inside a box and opening the box will kill the cat.  To an external observer the cat is in an indeterminate state which cannot be determined exactly (go Schroedinger!) without destroying that state.  Sorta like opening a file to determine the last access time...
  • tebing (unregistered)

    The real WTF is that the opening brace is on a seperate line, when everyone knows that it should look like this:

    enum Bool {
        ...
    };

  • (cs) in reply to Looce
    Anonymous:

    lucky luke:
    Anonymous:
    Anonymous:
    the real WTF is that I am at work today!
    The real WTF is that I'm unemployed and the guys whose code is so horrible that it makes this web site are not.


    hmmm... i wonder why?? maybe if you learned proper grammar you would be employed ;)

    That message has correct grammar.

    '(The real WTF) is [[that I'm unemployed] and [((the guys) whose code is [so horrible that it makes this web site]) are not]].'


    Shouldn't the 'that' be outside the braces? ie
    '(The real WTF) is that [[I'm unemployed] and [((the guys) whose code is [so horrible that it makes this web site]) are not{unemployed}]].'
  • Michael (unregistered) in reply to Ken Greene
    Anonymous:
    Ya also gotta love the way that "True"s value is zero in that enum as well - so if you do a:

    Bool check = True; if(check) { // blah blah blah }

    It will always fail.

    Or even: Bool launchNukes = False; if(launchNukes)...

    It's all fun and games 'til someone loses an eye!

    That is why you should always use the isTrue() function!

  • Ford Prefect (unregistered) in reply to Reeeeeaaaaaaly?

    In response to Reeeeeaaaaaaly?

    42 is the Answer to the Ultimate Question of Life, the Universe and Everything.
    Unfortunately nobody knows the Question.

    Loose paraphrasing of Douglas Adams' hilarious and irreverent science fiction parodies such as "The Hitchhiker's Guide to the Galaxy", "The Restaurant at the End of the Universe" and "Life, the Universe and Everything".

  • (cs) in reply to lurker
    Anonymous:

    The Meta-WTF?! is that people who fail classes in grammar and syntax think that makes them qualified for career in programming.  Programming is all about grammar and syntax, just not the "King's English" kind. 

    Grammar and syntax? Why differentiate the two?

    The structure of a language (its syntax) is governed by the rules of its grammar just like its morphology, phonology, phonetics, semantics, pragmatics and to a certain extent semiotics. While computer languages have a subset of natural language's features, it's all about the grammar.
  • trav (unregistered) in reply to Benzaholic
    Anonymous:

    And how might we map this to numeric values? 1, 0, 42?

    (I couldn't pass up the chance for my very first comment on TDWTF to be a possible first on a subject.)



    true > 0
    false < 0
    error == 0

    You haven't seen this before?
    Error does not indicate false, but rather that the test failed to execute.
    Bool is possibly a poor name for this enum, but it's not that big a deal

  • (cs) in reply to Looce
    Anonymous:

    Anonymous:
    I think it's a bit soon to be repeating things that were posted so recently. Most readers probably still remember them well! (Ha ha, the captcha word is "billgates".)

    That's for sure, given that this particular WTF (FileNotFound) has turned into a running joke.

    But do you remember the "[file name] is already exist. Are you file update?" dialog in a Pop-up Potpourri? I tink not. :)

    Captcha = quality


    <FONT face=Tahoma>I like those pop-up Potpourries! Gives me lots of laughs...

    Too bad we see them less now...

    "Do you want to apply this isolated undo step as a new edit? This might break the space continuum..." wow... :D



    </FONT>
  • (cs) in reply to Deparment of Redundancy Department

    Anonymous:
    Truthiness at its best!

    Everybody knows the correct way to add FileNotFound is by *subclassing* Bool.  Then you can add other fields, while you're at it.

     

    LOL. Superb.  In fact, why not make bool a pattern? I think it deserves that status. 

  • Dwonis (unregistered) in reply to bcat
    Anonymous:
    May I be the first to say: brillant!


    if (False) {
       mention_that_brillant_is_actually_French_for("brilliant");
    }
  • Iain Porter (unregistered) in reply to lucky luke
    lucky luke:
    Anonymous:
    lucky luke:
    Anonymous:
    Anonymous:
    the real WTF is that I am at work today!

    The real WTF is that I'm unemployed and the guys whose code is so horrible that it makes this web site are not.



    hmmm... i wonder why?? maybe if you learned proper grammar you would be employed ;)


    The real WTF?! here is that your grammar is only marginally better.


    yeah, I know... I failed english in high school... twice. That's why i'm a programmer!
    my problem was with this whole part "the guys whose code is so horrible that it makes this web site are not."
    maybe it just needs some punctuation... like:
    the guys, (whose code is so horrible) that it makes this web site, are not.
    now that i can understand. but still the "it" doesn't belong and it should be make, not makes...
    the guys, (whose code is so horrible) that make this website, are not.

    ahh, much better ;)


    nononono... you've just changed the meaning of what the original poster was saying.

    you may find it easier to understand if you read

    whose code is so horrible that it makes this web site


    as

    whose code is so horrible that it makes it onto this web site


  • Jon W (unregistered) in reply to ChiefCrazyTalk
    Anonymous:

    The real WTF is that I'm unemployed and the guys whose code is so horrible that it makes this web site are not.



    Being a team player is much more important than having skills. Think of Paula: She was a team player, until the very end!

  • azaris (unregistered) in reply to ammoQ
    ammoQ:

    Hmmm... what is the difference between fuzzy logic and the theory of probability?


    Fuzzy logic is not probability. A fuzzy variable can have multiple values at once. A random variable in probability has only one value, but with different probabilities.
  • TheDoom (unregistered) in reply to azaris

    "With most Americans (including myself) enjoying a long, Indepdence Day Weekend"


    Yanks eh? Any excuse...

  • (cs) in reply to Reeeeeaaaaaaly?

    Reeeeeaaaaaaly?:
    May I inquire: what is the significance of '42' ? Obviously a running joke I missed...

    That is not the correct question.

    It may be possible to compute the applicable question, but unfortunately no sufficiently powerful computer is in existence at this time.  You might want to build one.

  • (cs) in reply to Jon
    Jon:
    ParkinT:
    There are 10 types of people..
    • Those who understand binary
    • Those who don't

    That's not funny, it's just dumb. Go launch yourself into space. CAPTCHA = stfu

    Or better yet, celebrate Christmas on October 30th.  Because:

    24 dec == 30 oct

  • (cs) in reply to Ken Greene

    Ken Greene:
    Ya also gotta love the way that "True"s value is zero in that enum as well

    Which might make it worthwile to add type conversion to a proper bool...

    class Bool
    {
    public:
        typedef enum {True, False, FileNotFound} BoolEnum;
        BoolEnum value;
        operator bool() const
        {
            switch(value)
            {
                case True:
                case False:
                    return(!value);  // You might want to find out why.
                case FileNotFound:
                    throw FileNotFoundError("file not found");
            }
        }
    };

  • dept non style dep (unregistered) in reply to Phil the ruler of heck

    bool isTrue() {

    char true[] = "this is true";
    char false[] = "this is false";

    if ( something == true )
      return 1==1;
    else ( something == false)
      return 1==2;
    else
      return open("foobar.txt","rw");//NOTE: dont create this file!

    }

    --Tei

  • SadBugKiller (unregistered) in reply to Phil the ruler of heck
    Phil the ruler of heck:
    Or better yet, celebrate Christmas on October 30th.  Because:

    24 dec == 30 oct


    Or on Hexember 18th. No, wait...
  • Richard (unregistered)

    As noone seems to have noticed last time, here goes again:

    Boolean logic does work on true, false, undefined. Either do the math yourself or look at wikipedia. FileNotFound can, depending on context, be equivalent to undefined.

    Anyway, this is valid boolean logic.

    PS: Yes, i am aware that there are boolean algebras where unknown is equivalent to false

  • (cs) in reply to Richard

    Richard:
    Boolean logic does work on true, false, undefined. Either do the math yourself or look at wikipedia. FileNotFound can, depending on context, be equivalent to undefined.

    Actually, that would be TextNotFound.

    Just go to http://en.wikipedia.org/wiki/Boolean_logic then search for the term "undefined" on the displayed Web page.  What I get is "Text not found."

  • Iain Porter (unregistered) in reply to Phil the ruler of heck

    Surely it's better to celebrate Christmas at Halloween, since Dec 25 = Oct 31. Why would you celebrate Christmas on the 24th?

  • (cs) in reply to John Bigboote
    John Bigboote:
    Less is more, and this is the haiku of WTFs.


    Three things are certain
    Death, taxes, and file not found
    Guess which has occurred.


  • Looce (unregistered) in reply to Iain Porter

    Anonymous:
    Surely it's better to celebrate Christmas at Halloween, since Dec 25 = Oct 31. Why would you celebrate Christmas on the 24th?

    He celebrates Christmas on Christmas Eve...

  • An apprentice (unregistered) in reply to Jon
    Anonymous:
    ParkinT:

    There are 10 types of people..

    • Those who understand binary
    • Those who don't
    That's not funny, it's just dumb. Go launch yourself into space.

    In fact there are 1101 types of people:

    • those who understand jokes in decimal,
    • those who understand jokes in decimal and binary,
    • those who understand any jokes.
  • (cs)
    Alex Papadimoulis:
    The problem with "logic" is that it makes things out to be nothing but simple dualities. Proponents of logic want us to believe that everything is true or false, black or white, yes or no, paper or plastic, etc.

    enum Bool 
    { 
        True, 
        False, 
        FileNotFound 
    };

    The real WTF is that there are actually two WTF's.

    One is the misuse of the term "Boolean" when the thing should be called "Heyting."  A "Boolean" can only be either 0 or 1.  (Either do the math yourself or look it up in Wikipedia.)

    The other one is the data type.  If you go beyond Boolean and want to have values other than 0 or 1, then they need to be between 0 and 1, and you can't do that with an enum, or an int for that matter.

    So this might work:

    typedef enum {False = 0, True = 1} Boolean;

    const double Heyting::False = .0;
    const double Heyting::ENOENT = .42;   // no such file or directory
    const double Heyting::True = 1.;

  • (cs) in reply to ChiefCrazyTalk

    ChiefSmokeTooMuch:
    Anonymous:
    the real WTF is that I am at work today!
    The real WTF is that I'm unemployed and the guys whose code is so horrible that it makes this web site are not.

    Yeah, holy cow you REALLY must suck at coding ;)

  • (cs) in reply to impslayer

    impslayer:
    ChiefSmokeTooMuch:
    The real WTF is that I'm unemployed and the guys whose code is so horrible that it makes this web site are not.
    Yeah, holy cow you REALLY must suck at coding ;)

    Can we see a few samples please?

  • (cs) in reply to stevekj

    stevekj:
    John Bigboote:
    Less is more, and this is the haiku of WTFs.


    Three things are certain
    Death, taxes, and file not found
    Guess which has occurred.


    /me claps appreciatively.

  • (cs) in reply to impslayer

    It's a bit WTFish that the replies to this WTF are such a mix of

    1) People defending/defying bools/trools/whatnot seriously, AGAIN

    2) People just goofing around having fun (some VERY funny posts)

    3) People making totally off-topic posts

    (Ok, 3) checked for me.)

  • coz (unregistered)

    You are all fools....this is a stroke of Genius: imagine ! You don't have to declare variables for each error code...you just increase the Bool enum type....

    Of course , You'll have to compare all values with 0

    v= Bool.FileNotFound;

    if(v>0) { //error}

    else

    {//ok

    }

    What's not to understand? ....

    =)) :))))))))

     

  • (cs) in reply to coz

    Can anyone provide a scenario that can not be reduced to 1/0? 

  • Mr_Daemon (unregistered)

    I really wonder if there ever was an attempt that introducing fuzzy logic to programming languages.

    Multiples degrees of truth for the win.



    captcha: zork

    oh my childhood.

  • Mike (unregistered)

    The real WTF is that no WTF's get posted until we computer geeks are supposed to be working. Good thing the computer illiterate bosses don't know this.

  • (cs) in reply to Iain Porter
    Anonymous:
    lucky luke:
    Anonymous:
    lucky luke:
    Anonymous:
    Anonymous:
    the real WTF is that I am at work today!

    The real WTF is that I'm unemployed and the guys whose code is so horrible that it makes this web site are not.



    hmmm... i wonder why?? maybe if you learned proper grammar you would be employed ;)


    The real WTF?! here is that your grammar is only marginally better.


    yeah, I know... I failed english in high school... twice. That's why i'm a programmer!
    my problem was with this whole part "the guys whose code is so horrible that it makes this web site are not."
    maybe it just needs some punctuation... like:
    the guys, (whose code is so horrible) that it makes this web site, are not.
    now that i can understand. but still the "it" doesn't belong and it should be make, not makes...
    the guys, (whose code is so horrible) that make this website, are not.

    ahh, much better ;)


    nononono... you've just changed the meaning of what the original poster was saying.

    you may find it easier to understand if you read

    whose code is so horrible that it makes this web site


    as

    whose code is so horrible that it makes it onto this web site




    how about

    whose code is so horrible that it makes this web site work so badly

  • WTF?! (unregistered) in reply to lemon
    Anonymous:
    Anonymous:
    Anonymous:
    the real WTF is that I am at work today!

    well i've been in work also on saturday and sunday, and i plan to work tommorow as well.

    P.S. i'm not american ;)



    I work today - I'm Canadia. We should get today off but my employer gave me friday off instead (Sat. was Canada Day)


    I'm Canadia.....
    argg

    do they even know how to program up there?
     
    next time lets see you place all the letters when making a reference to our great country.
    or I will send Johnny Pasta over and he will break your legs like spagetti.

    I got monday instead of friday.
    what I needed was the whole week off tho...

  • mrputter (unregistered) in reply to Phil the ruler of heck

    > when the thing should be called "Heyting."

    Damn. Beat me to it.


    <font face="Courier New" size="2">public abstract class Heyting {
        public final float Top = 1.0;
        public final float Bottom = 0.0;

        public float leq( float a, float b );

        protected float sup( float a, float b ) {
            return (leq( a, b ) ? b : a);
        }
        protected float inf( float a, float b ) {
            return (leq( a, b ) ? a : b);
        }

        public float join( float[] s ) {
            int jn = s[0];
            if (s.length > 1)
                for (int i = 1; i < s.length, i++)
                    jn = sup( jn, s[i] );
            return jn;
        }
        public float meet( float[] s ) {
            int mt = s[0];
            if (s.length > 1)
                for (int i = 1; i < s.length, i++)
                    mt = inf( mt, s[i] );
            return mt;
        }
        public float not( float a ) {
            return arrow( a, Bottom );
        }
        public float arrow( float a, float b ) {
            if (leq( a, b )) {
                return Top;
            } else {
                return b;
            }
        }
    }

    public class WTF extends Heyting {
        public final float True = Top;
        public final float False = Bottom;
        public final float FileNotFound = 0.42;

        public float leq( float a, float b ) {
            return (a <= b);
        }
    }
    </font>
    There. No more WTF.

  • (cs)
    Anonymous:
    There isn't anything much wrong with that enum that I can see. Logic doesn't have to be true or false.

    Nothing wrong with saying: It's true, it's false, or we don't know.

    Oval uses 6 logic results that can be combined with other results ( http://tinyurl.com/h9yc2 )

    look for <font face="Times" size="3">== DirectivesType ==</font>



    Interestingly enough, the fact that you don't know doesn't change the fact that a thing is either true or not true.
  • The 2-Belo (unregistered)

    <FONT size=2>Set Jessep = Request.Answers();
    Set Kaffee = Request.Answers(True); 
    If(Kaffee) { 
    </FONT><FONT size=2>      Throw New Truth.UnhandledException(Jessup);
    }</FONT>

    <FONT size=2>Okay, so it was an obscure joke.</FONT>

    <FONT size=2>--
    $0.02
    </FONT>

  • Johan Gill (unregistered)

    Calling that type Bool gives entirely wrong associations, and the three values are not the whole story here. Names indicating general truth values (True, False) are mixed with a more domain specific name (FileNotFound), adding to potential confusion. How about doing as below instead?

    enum Result
    {
        Success,
        Failure,
        FileNotFound
    };

  • anonymous (unregistered) in reply to Johan Gill

    Yet another approach, bitmasks

    #define FILENOTFOUND_ERROR  1000b
    #define OVERFLOW_ERROR 0100b
    #define FALSE 0010b
    #define TRUE   0001b
    #define SUCCESS   0001b
    #define ERROR 1111b

    #define isError(errorcode) (errorcode & ERROR)
    #define isTrue(errorcode) (errorcode & TRUE)
    #define isFalse(errorcode) (errorcode & FALSE)
    #define isFileNotFound(errorcode) (errorcode & FILENOTFOUND_ERROR)

    The nice feature of that, is you can combine errors:

    return SUCCESS | FILENOTFOUND_ERROR;










  • M (unregistered) in reply to anonymous

    Bitmaps are used when you have a set of independent boolean states that can happen (or can be set by a user) and you want/need an effective data structure for storing them. Independent here means that in general, any permutation of the bits can be considered being a valid response.

    Not so in your example.

    Also,

    return SUCCESS | FILENOTFOUND_ERROR;

    always returns true.

  • Ferranti Jeff (unregistered) in reply to M

    Doesn't Microsoft do this for ages ?

    Microsoft Access checkbox : true, false, unknown ...

    Greetz

  • (cs) in reply to Jon
    Anonymous:
    ParkinT:

    There are 10 types of people..

    • Those who understand binary
    • Those who don't

    That's not funny, it's just dumb. Go launch yourself into space. CAPTCHA = stfu

    It is obvious, sir, that you DO NOT understand binary.

  • anonymous (unregistered) in reply to M
    Anonymous:
    Also,

    return SUCCESS | FILENOTFOUND_ERROR;

    always returns true.



    You can compile this and run. Will return 9, that is.. true, because is noncero. But on this code a function can return a nonzero value, 0x2, that is FALSE.  

    #include "stdio.h"

    #define FILENOTFOUND_ERROR  0x8
    #define OVERFLOW_ERROR 0x4
    #define FALSE 0x2
    #define TRUE   0x1
    #define SUCCESS   0x1
    #define ERROR 0x15

    #define isError(errorcode) (errorcode & ERROR)
    #define isTrue(errorcode) (errorcode & TRUE)
    #define isFalse(errorcode) (errorcode & FALSE)
    #define isFileNotFound(errorcode) (errorcode & FILENOTFOUND_ERROR)


    int fun(){   
        return  SUCCESS | FILENOTFOUND_ERROR;
    }

    int fun2(){
         return ERROR | FILENOTFOUND_ERROR;
    }

    int main(){
       
        printf("Test: %d\n", fun() );
        //Will print "Test: 9"  
        printf("Test2: %d\n", fun2() );

        //Will print "Test: 29"  

        return 0;
    }

Leave a comment on “Classic WTF - What is Truth?”

Log In or post as a guest

Replying to comment #80162:

« Return to Article