The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Multilanguage Truth

Last post 01-21-2008 5:30 PM by elgate. 29 replies.
Page 1 of 1 (30 items)
Sort Posts: Previous Next
  • 01-16-2008 11:08 AM

    • yoz-y
    • Not Ranked
    • Joined on 05-06-2006
    • Posts 3

    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 ...)

     

  • 01-16-2008 11:21 AM In reply to

    Re: Multilanguage Truth

    yoz-y:
    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"?
  • 01-16-2008 11:29 AM In reply to

    • H|B
    • Top 500 Contributor
    • Joined on 03-28-2007
    • Posts 59

    Re: Multilanguage Truth

    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

    #define TRUE (TRWTF == PHP)
  • 01-16-2008 11:30 AM In reply to

    • XIU
    • Top 200 Contributor
    • Joined on 01-08-2007
    • Posts 134

    Re: Multilanguage Truth

    Isn't BOOL just defined as int? But for the rest, damn, wtf were they thinking :|
  • 01-16-2008 11:38 AM In reply to

    • Daid
    • Top 100 Contributor
    • Joined on 01-30-2007
    • Posts 282

    Re: Multilanguage Truth

    XIU:
    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.

  • 01-16-2008 11:48 AM In reply to

    Re: Multilanguage Truth

    H|B:
    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

    # The Brillant Paula Bean
    # Author:: derula
    # Copyright:: Copyright (c) 2005-2008 Paula Bean
    # License:: Originally distributed under a
    # proprietary license by Paula Bean.
    # Ruby port by derula published
    # under the same terms as Ruby's.

    # This module provides a method to return the
    # brillance of Paula Bean. This can be achieved
    # by calling the module method get_paula.

    module Paula_Bean

    # This constant stores the essence of Paula
    # Bean's brillance. This is a private
    # constant, so you MAY NOT use
    # Paula_Bean::PAULA to access it! Please use
    # the get_paula method instead.

    PAULA = "Brillant"

    # Returns Paula Bean's brillance.
    def self.get_paula
    return PAULA
    end
    end
  • 01-16-2008 12:16 PM In reply to

    • operagost
    • Top 150 Contributor
    • Joined on 03-19-2007
    • Pennsylvania, USA
    • Posts 219

    Re: Multilanguage Truth

    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...
     


  • 01-16-2008 12:39 PM In reply to

    Re: Multilanguage Truth

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

     

  • 01-16-2008 1:15 PM In reply to

    Re: Multilanguage Truth

    yoz-y:

    #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. 

  • 01-16-2008 1:16 PM In reply to

    Re: Multilanguage Truth

    Exteris:
    # 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.
    irc://irc.slashnet.org/#TDWTF
    "You acquaint the SURLY THUGS with your brand of diplomacy."


  • 01-16-2008 1:34 PM In reply to

    Re: Multilanguage Truth

    yoz-y:

    #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. 

  • 01-16-2008 1:42 PM In reply to

    Re: Multilanguage Truth

    And thanks to Unicode, we can extend this to Mandarin and Sanskrit too! What an exciting world we live in!
  • 01-16-2008 1:46 PM In reply to

    Re: Multilanguage Truth

    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

  • 01-16-2008 1:57 PM In reply to

    Re: Multilanguage Truth

    vt_mruhlin:

    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. 

    — Flurp.
  • 01-16-2008 2:04 PM In reply to

    Re: Multilanguage Truth

    dhromed:
    vt_mruhlin:

    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?
    irc://irc.slashnet.org/#TDWTF
    "You acquaint the SURLY THUGS with your brand of diplomacy."


  • 01-16-2008 2:30 PM In reply to

    Re: Multilanguage Truth

    Lingerance:
    //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.

  • 01-16-2008 3:00 PM In reply to

    Re: Multilanguage Truth

    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.

  • 01-16-2008 3:36 PM In reply to

    Re: Multilanguage Truth

    Lingerance:
    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 


    -- Never play leapfrog with a unicorn
  • 01-16-2008 9:47 PM In reply to

    Re: Multilanguage Truth

    Daid:
    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.
    Filed under: ,
  • 01-17-2008 7:54 AM In reply to

    Re: Multilanguage Truth

    operagost:
    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é.

    the forum software ate my colon
  • 01-18-2008 9:00 PM In reply to

    • aib
    • Top 500 Contributor
    • Joined on 01-03-2007
    • Posts 87

    Re: Multilanguage Truth

    Talchas:
    yoz-y:

    #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>, ...;

    I may or may not have meant what I've said above.
  • 01-20-2008 7:03 PM In reply to

    Re: Multilanguage Truth

     what about baleen while we're at it?

    300 posts! This is Spar... dang I just lost the game.
    Legendary Thread
    lolwtf: Instead of comfy chair, package contained bobcat. Would not buy again.
    curtmack: It's like Godwin's Law, but instead of Hitler it's xkcd references.
    morbiuswilters: Right, but the Holocaust wasn't nearly as bad as xkcd.
  • 01-20-2008 8:56 PM In reply to

    Re: Multilanguage Truth

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

  • 01-21-2008 12:50 AM In reply to

    Re: Multilanguage Truth

     Or we could use base 1.

    1 is 1 and 0 is  

    300 posts! This is Spar... dang I just lost the game.
    Legendary Thread
    lolwtf: Instead of comfy chair, package contained bobcat. Would not buy again.
    curtmack: It's like Godwin's Law, but instead of Hitler it's xkcd references.
    morbiuswilters: Right, but the Holocaust wasn't nearly as bad as xkcd.
    Filed under: ,
  • 01-21-2008 7:19 AM In reply to

    Re: Multilanguage Truth

    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.

    TRWTF is Community Server
  • 01-21-2008 8:55 AM In reply to

    Re: Multilanguage Truth