• (cs) in reply to J
    J:
    QJo:
    The fact that the loop goes from 0 to 26 is a minor issue that ought to be fixable by adding a do-nothing "default" option to the case statement.

    In all the languages I know, the case/switch/select construct has an implicit do-nothing default if a default is not given. Is VB different?

    The language that's compiled to the same MSIL as C# .NET (assuming you're talking about VB .NET)? It should have it.

    Good reading: http://stackoverflow.com/questions/4649423/should-switch-statements-always-contain-a-default-clause

  • Mr. Yak (unregistered)

    Brought to you by the symbol umlaut and the number e. Not the letter e, but the number whose exponential function is the derivative of itself.

    captcha: damnum - "e is one of those damnums"

  • (cs) in reply to chubertdev
    chubertdev:
    J:
    In all the languages I know, the case/switch/select construct has an implicit do-nothing default if a default is not given. Is VB different?

    The language that's compiled to the same MSIL as C# .NET (assuming you're talking about VB .NET)? It should have it.

    A lot of compilers will spit warnings at you if you don't include a default case... it might technically be fine, but it just makes for better readability (and thereby, more robust code) to include a default case even if empty.

  • (cs) in reply to eViLegion
    eViLegion:
    chubertdev:
    J:
    In all the languages I know, the case/switch/select construct has an implicit do-nothing default if a default is not given. Is VB different?

    The language that's compiled to the same MSIL as C# .NET (assuming you're talking about VB .NET)? It should have it.

    A lot of compilers will spit warnings at you if you don't include a default case... it might technically be fine, but it just makes for better readability (and thereby, more robust code) to include a default case even if empty.

    Yeah, I like that feature. Some people are just OCD about not having ANY line of code that wouldn't change the program by having it removed.

  • (cs) in reply to Peter
    Peter:
    Apropos of nothing in particular, my (poor, dead) mummy taught us the alphabet song as children, since television had only recently been invented, and Kermit the Frog was not even a tadpole. After we had tried to imitate her, she would recite the alphabet *backwards*.

    This amazed us children, and when we asked her how and why she had learned to do this, she told us she had just felt like it. Only later did we learn that she had been involved in code breaking for the Navy in WWII (at age 25), which went a long way towards explaining her daily crossword puzzle habit as well...

    I learned how to do that in 1966 when I saw this version of Alice in Wonderland on television.

    As for the index, the Artists tab in my iPod's music library runs alphabetically from a-ha to 蔡依林.

  • Norman Diamond (unregistered) in reply to Mr. Yak
    Mr. Yak:
    Brought to you by the symbol umlaut and the number e. Not the letter e, but the number whose exponential function is the derivative of itself.

    captcha: damnum - "e is one of those damnums"

    Yeah, another WTF is Unicode, which was almost finished unifying CJK when they decided to multify stuff like e and e, f and script f, π and π, etc.

  • Norman Diamond (unregistered) in reply to faoileag
    faoileag:
    Architect:
    This is a sterling example of hardened Enterprisey code. One never knows when the Alphabet Committee would introduce new letters and as such is beautifully future-proofed as well.
    You are making fun of this, but please keep in mind that the Alphabet Committee is curently debating the introduction of an uppercase letter "ß" (or ß in HTML parlance), although there is not one single word that uses it (ok, I know it's all about "all capitals" but still).
    Architect was talking about the American alphabet. Letters like ñ and ó are used in part of the US.
  • Captain Oblivious (unregistered) in reply to Norman Diamond
    Norman Diamond:
    faoileag:
    Architect:
    This is a sterling example of hardened Enterprisey code. One never knows when the Alphabet Committee would introduce new letters and as such is beautifully future-proofed as well.
    You are making fun of this, but please keep in mind that the Alphabet Committee is curently debating the introduction of an uppercase letter "ß" (or ß in HTML parlance), although there is not one single word that uses it (ok, I know it's all about "all capitals" but still).
    Architect was talking about the American alphabet. Letters like ñ and ó are used in part of the US.

    How naïve. Accents and diereses don't make them different letters. Letters and these modifiers coöperate to indicate pronunciation in ambiguous circumstances.

  • Sven (unregistered)

    that is how I see it: f i=65:1:90 w $c(i)

  • Norman Diamond (unregistered) in reply to Captain Oblivious
    Captain Oblivious:
    Norman Diamond:
    faoileag:
    Architect:
    This is a sterling example of hardened Enterprisey code. One never knows when the Alphabet Committee would introduce new letters and as such is beautifully future-proofed as well.
    You are making fun of this, but please keep in mind that the Alphabet Committee is curently debating the introduction of an uppercase letter "ß" (or ß in HTML parlance), although there is not one single word that uses it (ok, I know it's all about "all capitals" but still).
    Architect was talking about the American alphabet. Letters like ñ and ó are used in part of the US.
    How naïve. Accents and diereses don't make them different letters. Letters and these modifiers coöperate to indicate pronunciation in ambiguous circumstances.
    You might be right for ó (for a language commonly used in the US). However, ñ is a separate letter, just as W is a separate letter from V (again being US centric -- though as someone pointed out, W recently became a separate letter in Sweden too.)
  • (cs) in reply to Captain Oblivious
    Captain Oblivious:
    Norman Diamond:
    faoileag:
    Architect:
    This is a sterling example of hardened Enterprisey code. One never knows when the Alphabet Committee would introduce new letters and as such is beautifully future-proofed as well.
    You are making fun of this, but please keep in mind that the Alphabet Committee is curently debating the introduction of an uppercase letter "ß" (or ß in HTML parlance), although there is not one single word that uses it (ok, I know it's all about "all capitals" but still).
    Architect was talking about the American alphabet. Letters like ñ and ó are used in part of the US.

    How naïve. Accents and diereses don't make them different letters. Letters and these modifiers coöperate to indicate pronunciation in ambiguous circumstances.

    In some languages they do. AFAIK the modified letters in Swedish and (I believe) Danish, for example, come at the end of the alphabet rather than (as you'd expect) next to the letter they are modified from. This can confuse the noob linguist.

  • Another Mw (unregistered) in reply to MW
    MW:
    This actually happened just a few years ago in Sweden. The Swedish Academy formally decided to recognize W as an independent character (it was previously equivalent with V here in Sweden). So the 28 letter alphabet we used to have suddenly became 29 letters long.

    "Just a few years ago".... Googles it Well butter my butt and call me a biscuit, that wizzed right past my head, I was just finished learning the alphabet by then!

    Captcha: sino, no, learned that about two years ago.

  • Ventrimaculatus (unregistered)

    True, danish has 3 letters more than common english, æøå... And added to the end of the alphabet.

    Though they are relativly new letters, and they used to be written

    æ = ae ø = oe å = aa

    To make an example, would be like english making a letter to substitute ch with it's own letter because it's used often.

  • Hasse (unregistered)

    Seems most people missing the point in the code. There are two independent WTF's here:

    1. A use of a for loop around a case where the case builds up a full list of the alphabet, possibly missing some Swedish, Danish, German, Islandic or other languages characters and not mentioning the code page used. The consequenses of that can ge read in http://thedailywtf.com/Comments/There-and-Back-Again.aspx. I.e this code does not need a for loop or a case statement. just a list of assignment would be faster and easier to maintain.

    2. Why on earth is a list of all English/US characters needed in a database table where two columns contins the same value?

  • Pero perić (unregistered) in reply to Captain Oblivious
    Captain Oblivious:
    Norman Diamond:
    faoileag:
    Architect:
    This is a sterling example of hardened Enterprisey code. One never knows when the Alphabet Committee would introduce new letters and as such is beautifully future-proofed as well.
    You are making fun of this, but please keep in mind that the Alphabet Committee is curently debating the introduction of an uppercase letter "ß" (or ß in HTML parlance), although there is not one single word that uses it (ok, I know it's all about "all capitals" but still).
    Architect was talking about the American alphabet. Letters like ñ and ó are used in part of the US.

    How naïve. Accents and diereses don't make them different letters. Letters and these modifiers coöperate to indicate pronunciation in ambiguous circumstances.

    Left(name, 1) disagrees

    Ventrimaculatus:
    True, danish has 3 letters more than common english, æøå... And added to the end of the alphabet.

    Though they are relativly new letters, and they used to be written

    æ = ae ø = oe å = aa

    To make an example, would be like english making a letter to substitute ch with it's own letter because it's used often.

    Croatian has quite a history with those. For now they use diacritics č (ch in check), ć (soft č), đ (j in jam, but I may be wrong), š (sh in shoe) and ž (j in déjà vu) and few digraphs: dž, lj and nj. Fortunately they are near the letter they visually modify. Putting them to the end of abeceda (same as alphabet but with a, b, c, ... instead of alpha, beta, ...).

  • (cs) in reply to MW
    MW:
    This actually happened just a few years ago in Sweden. The Swedish Academy formally decided to recognize W as an independent character (it was previously equivalent with V here in Sweden). So the 28 letter alphabet we used to have suddenly became 29 letters long.

    This can be directly attributed to the rise of the Internet. The Swedes were sick of having to say Vorld Vide Veb and have everyone mistake them for Transylvanians.

  • Jay (unregistered)

    On the slightly serious side, surely half the WTF here is that he writes a loop and then puts a case statement inside the loop that makes it do something on every iteration anyway. If he eliminated the loop AND the case, and just executed each block of code in turn, the program would be half as long and do exactly the same thing. It would still be stupid for other reasons, but at least it would be LESS stupid.

    Really stupid:

    for i = 0 to 3
      switch (i)
        case 0:
          ... do thing 0 ...
        case 1:
          ... do thing 1 ...
        case 2:
          ... do thing 2 ...
    next
    

    Less stupid:

    ... do thing 0 ...
    ... do thing 1 ...
    ... do thing 2 ...
    
  • Pero perić (unregistered)

    That makes me realize VB.net (and probably good old VB 6) breaks the case by default. Fitting for high level language. I wish C# and Java had it that way too since those are not bit shifters either.

  • anonymous (unregistered) in reply to Jay
    Jay:
    On the slightly serious side, surely half the WTF here is that he writes a loop and then puts a case statement inside the loop that makes it do something on every iteration anyway. If he eliminated the loop AND the case, and just executed each block of code in turn, the program would be half as long and do exactly the same thing. It would still be stupid for other reasons, but at least it would be LESS stupid.

    Really stupid:

    for i = 0 to 3
      switch (i)
        case 0:
          ... do thing 0 ...
        case 1:
          ... do thing 1 ...
        case 2:
          ... do thing 2 ...
    next
    

    Less stupid:

    ... do thing 0 ...
    ... do thing 1 ...
    ... do thing 2 ...
    
    The Loop-switch is a common WTF and has been the subject of TDWTF on several occasions. In fact, the Wikipedia article cites TDWTF: The FOR-CASE paradigm Switched on Loops [color=#eee]Oops, Askimet thinks this comment is spam
  • (cs) in reply to Pero perić
    Pero perić:
    That makes me realize VB.net (and probably good old VB 6) breaks the case by default. Fitting for high level language. I wish C# and Java had it that way too since those are not bit shifters either.

    The differences between a C-style switch and a VB select are huge.

    http://stackoverflow.com/questions/5891143/c-sharp-switch-statement-more-limited-than-vb-net-case

  • Neil (unregistered) in reply to JAPH
    JAPH:
    We have such issues in Hawaiian with the kahako and `okina. We decided on the following collation: L1. Kahako and `okina are ignored unless all other letters are the same L2. A vowel followed by a kahako follows the same vowel not followed by a kahako L3. A vowel preceded by an `okina follows the same vowel not preceded by an `okina

    Ohana</i> is therefore located under <i>O</i> and <i>Laie follows Laie

    But does a vowel followed by a kahako follow or precede a vowel preceded by an `okina?

  • Neil (unregistered) in reply to alo
    alo:
    Dim Frist(5) Frist(1) = 69  ' F Frist(2) = 113 ' r Frist(3) = 104 ' i Frist(4) = 114 ' s Frist(5) = 115 ' t
    FTFY

Leave a comment on “Today's Article is Brought to You by the Letters "WTF"”

Log In or post as a guest

Replying to comment #415706:

« Return to Article