Multilanguage Truth



  • #define TRUE (1 == 1) <= ow my eyes

    #define boolean int <= what ?

    now in my college they took a different approach :

    (found in a C source file we had to work on on C classes)

    typedef enum{FAUX=0, Faux=0, faux=0, FALSE=0, False=0, false=0,
             VRAI=1, Vrai=1, vrai=1, TRUE=1,  True=1,  true=1} Booleen;

     

    Not only  they managed to handle the personal preferences of everybody.  They also happened to provide both French and English wordings.

    I find this a bit odd since they only defined Booleen and no Boolean. (not even speaking about BOOLEAN, booleen ...)

     



  • @yoz-y said:

    I find this a bit odd since they only defined Booleen and no Boolean. (not even speaking about BOOLEAN, booleen ...)
    I'm not 100% sure here, but are you implying that some people pronounce the word boolean as "bool een" as opposed to "bool ee en"?



  • Extending Booleen:

    typedef enum{FAUX=0, Faux=0, faux=0, FALSE=0, False=0, false=0, VRAI=1, Vrai=1, vrai=1, TRUE=1, True=1, true=1,
    verdadeiro=1, Verdadeiro=1, VERDADEIRO=1, falso=0, Falso=0, FALSO=0} Booleen



  • Isn't BOOL just defined as int? But for the rest, damn, wtf were they thinking :|



  • @XIU said:

    Isn't BOOL just defined as int?
    Kinda depents on your world. I think in C it is. In Java it's a primitive right? with the boolean object version. In VB it's a own type, lua has a boolean type, so has php. Most insane version I've seen was in some C++ code, in which BOOL was an class, with it's own factory.

    C# has FILE_NOT_FOUND ;-) as extra option in the boolean.



  • @H|B said:

    Extending Booleen:

    typedef enum{FAUX=0, Faux=0, faux=0, FALSE=0, False=0, false=0, VRAI=1, Vrai=1, vrai=1, TRUE=1, True=1, true=1,
    verdadeiro=1, Verdadeiro=1, VERDADEIRO=1, falso=0, Falso=0, FALSO=0} Booleen

    oh, and while you're on it, you can also make it:

    typedef enum{FAUX=0, Faux=0, faux=0, FALSE=0, False=0, false=0, VRAI=1, Vrai=1, vrai=1, TRUE=1, True=1, true=1,
    verdadeiro=1, Verdadeiro=1, VERDADEIRO=1, falso=0, Falso=0, FALSO=0, WAHR=1, Wahr=1, wahr=1, FALSCH=0, Falsch=0, falsch=0} Booleen



  • typedef enum{FAUX=0, Faux=0, faux=0, FALSE=0, False=0, false=0,

             VRAI=1, Vrai=1, vrai=1, TRUE=1,  True=1,  true=1, dossier_non_trouvé=2, file_not_found=2} Booleen;

     Fixed...
     




  • # define FALSE = (SwampSearch('Foo') == SwampSearch('Foo'))

     



  • @yoz-y said:

    #define TRUE (1 == 1) <= ow my eyes

    #define boolean int <= what ?

    Actually, this isn't that bad (in C) - the best you can do for a boolean is some sort of integer type, and (1==1) is the best way to define true if you need to do so, because the value of (1==1) is only guaranteed to be nonzero (I think). So if you want "return TRUE" to be consistent with true-false generated by the comparison ops, this is a good way to do it.

     



    now in my college they took a different approach :

    (found in a C source file we had to work on on C classes)

    typedef enum{FAUX=0, Faux=0, faux=0, FALSE=0, False=0, false=0,
             VRAI=1, Vrai=1, vrai=1, TRUE=1,  True=1,  true=1} Booleen;

     

    Not only  they managed to handle the personal preferences of everybody.  They also happened to provide both French and English wordings.

    I find this a bit odd since they only defined Booleen and no Boolean. (not even speaking about BOOLEAN, booleen ...)

     

    Now thats just WTF. 



  • @Exteris said:

    # define FALSE = (SwampSearch('Foo') == SwampSearch('Foo'))

    Sweet I've always wanted to be able to do:

    Booleen done FALSE; //Reads funny
    
    while (!done) {
    //Eat pie and waffles
    }
    

    But alas, even with your generously provided code my program hangs during the "Booleen done FALSE". Please email me the codes, kind sir.



  • @yoz-y said:

    #define TRUE (1 == 1) <= ow my eyes

    That's a very old trick, dating back to when systems tended to have absurd rules like "0 is false, -1 is true, all other values are OUT OF CHEESE ERROR". More than a few old (as in greybeard) programmers have the habit of writing true and false as 1==1 and 1==0. It's easier than remembering what the numbers mean for whatever language this particular machine used. 



  • And thanks to Unicode, we can extend this to Mandarin and Sanskrit too! What an exciting world we live in!



  • Oooh, ooh, the other day I wanted to post this but forgot.  From some legacy C code, there were a number of functions declared as follows:

    PRIVATE int fooBar()

    "Wait a minute... These are global scope.  How can they be private?"

    About 30 minutes of code searching later:

    #define PRIVATE static



  • @vt_mruhlin said:

    Oooh, ooh, the other day I wanted to post this but forgot.  From some legacy C code, there were a number of functions declared as follows:

    PRIVATE int fooBar()

    "Wait a minute... These are global scope.  How can they be private?"

    About 30 minutes of code searching later:

    #define PRIVATE static

    That's just malicious. 



  • @dhromed said:

    @vt_mruhlin said:

    Oooh, ooh, the other day I wanted to post this but forgot.  From some legacy C code, there were a number of functions declared as follows:

    PRIVATE int fooBar()

    "Wait a minute... These are global scope.  How can they be private?"

    About 30 minutes of code searching later:

    #define PRIVATE static

    That's just malicious. 

    //From winuser.h
    WINUSERAPI
    int
    WINAPI
    ToUnicodeEx(
        UINT wVirtKey,
        UINT wScanCode,
        PBYTE lpKeyState,
        LPWSTR pwszBuff,
        int cchBuff,
        UINT wFlags,
        HKL dwhkl);
    
    Not exactly the same as unsing a keyword, but really what's the point of having them when the user already knows they are reading a windows header file?


  • @Lingerance said:

    //From winuser.h
    ... ToUnicodeEx

    Not exactly the same as unsing a keyword, but really what's the point of having them when the user already knows they are reading a windows header file?

    Visual Studio's Intellisense will display the comment immediately preceeding a function declaration when that function's intellisense popup appears.

    So, in this case, when you type the open paren in "ToUnicodeEx(", you get a popup that gives you the function signature as well as telling you from which header it came. Not horribly useful, considering that there's a quick context option to go to the definition, and a better solution would be to always display the filename where the function was defined, but that's the rationale, anyway.



  • In Maya, the MEL scripting language and command line system interpret as follows:

    False = false, 0, off

    True = true, 1, on

    And depending on who maintained that part of the documentation, they're all used interchangeably.  It actually makes sense in a lot of situations though since certain options are really being turned "off" while others are being falsified.  When the animators who have no coding experience see "off" they know what it means.



  • @Lingerance said:

    Booleen done FALSE; //Reads funny

    while (!done) {
    //Eat pie and waffles
    }

    I always liked the "fun with unix command lines" stuff. Things like:

     % got a light?
    No match.

    % man woman
    No manual entry for woman 




  • @Daid said:

    Most insane version I've seen was in some C++ code, in which BOOL was an class, with it's own factory.

    Why don't you look up how it's done in Smalltalk? I'll wait here, with popcorn.



  • @operagost said:

    typedef enum{FAUX=0, Faux=0, faux=0, FALSE=0, False=0, false=0,

             VRAI=1, Vrai=1, vrai=1, TRUE=1,  True=1,  true=1, dossier_non_trouvé=2, file_not_found=2} Booleen;

     Fixed...

    Actually that should be fichier_non_trouvé.



  • @Talchas said:

    @yoz-y said:

    #define TRUE (1 == 1) <= ow my eyes

    #define boolean int <= what ?

    Actually, this isn't that bad (in C) - the best you can do for a boolean is some sort of integer type, and (1==1) is the best way to define true if you need to do so, because the value of (1==1) is only guaranteed to be nonzero (I think). So if you want "return TRUE" to be consistent with true-false generated by the comparison ops, this is a good way to do it.

    Nah, such operators yield either 0 or 1 (I had to check the standards myself). (C90 §6.3.8 or C99 §6.5.9)

    asuffield's got a point, though -- it's practical.
     

     

    typedef enum{FAUX=0, Faux=0, faux=0, FALSE=0, False=0, false=0,
             VRAI=1, Vrai=1, vrai=1, TRUE=1,  True=1,  true=1} Booleen;

     

    Not only  they managed to handle the personal preferences of everybody.  They also happened to provide both French and English wordings.

    I find this a bit odd since they only defined Booleen and no Boolean. (not even speaking about BOOLEAN, booleen ...)

     


    For true multi-language support, they should do:

    typedef enum { ... } Boolean, Booleen, IkiDegerli, <translation>, <translation>, ...;



  •  what about baleen while we're at it?



  • Surely just using base-2 solves all this. 1 is 1 and 0 is 0, is it not?



  •  Or we could use base 1.

    1 is 1 and 0 is  



  • 1 is 1, 0 does not exist, the base-1 system is non positional. Counting goes 1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 111111111, and so on.



  •  I heard a theory that if we ever met an alien race with three fingers on each hand, they would do math in base 6.  



  • @belgariontheking said:

    I heard a theory that if we ever met an alien race with three fingers on each hand, they would do math in base 6.  

    You're correct, assuming they have two hands.



  • I believe all expressions evaluate to false in France. There seems to be a bug in the code.



  • @medialint said:

    I believe all expressions evaluate to false in France. There seems to be a bug in the code.

     

     OMGZ SEND ME CODES!!1!!`



  • @medialint said:

    I believe all expressions evaluate to false in France. There seems to be a bug in the code.
     

    Unless the expression involves a white flag, then it's automatically true ;) 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.