• (disco)
    public static string[] VALID_FRISTS = new string[] 
    {
        "frist",   // English
        "erste",   // German
        "première",     // French
        "最初",    // Japanese
        "처음으로",    // Korean
        "første",   // Danish
        "ensimmäinen",     // Finnish
        "första",   // Swedish
        "første",    // Norwegian
        "eerste",    // Dutch
        "primero"     // Spanish
    };
    
  • (disco)

    Did I just read this article on TDWTF?

    ... I am losing faith...

  • (disco)
    Comment held for moderation.
  • (disco) in reply to VinDuv
    Comment held for moderation.
  • (disco) in reply to Zacrath
    Comment held for moderation.
  • (disco) in reply to VinDuv
    Comment held for moderation.
  • (disco) in reply to VinDuv
    Comment held for moderation.
  • (disco) in reply to aliceif
    aliceif:
    I am truly impressed by your searching skills / memory.

    Thanks. I tend to only remember completely useless things, though... (at least looking for “Deulish” was easy enough)

  • (disco) in reply to discoursebot
    Comment held for moderation.
  • (disco) in reply to VinDuv
    Comment held for moderation.
  • (disco) in reply to VinDuv

    So the original was in C# and this one is in Java. I can just see it now. "Well, this is how I wrote it while working for another company. I can do the same here, but in Java this time."

  • (disco) in reply to Nutster

    Java? Java uses Strings. Not strings.

  • (disco)

    Let's count the WTFs, shall we?

    1. Using a string array instead of an enum;
    2. Not using the appropriate ISO-codes;
    3. comparing each individual letter instead of the entire string;
    4. Looping over all the strings instead of an Array.Contains() function.
    5. Passing the entire url instead of just the code;
    6. The fact that this has already been released before, twice even.
  • (disco) in reply to Nzall
    Nzall:
    The fact that this has already been released before, twice even.

    The second was a "Classic WTF" article. Doesn't count.

  • (disco)

    Apparently the server does not see fit to preview the comments.

    [image]
  • (disco) in reply to abarker

    Very odd, it used to work earlier.

    The Frontpage is no longer worthy of Discourse's comments.

  • (disco) in reply to Zacrath
    Zacrath:
    The second was a "Classic WTF" article. Doesn't count.

    Yes it does. He gets two links to read how not to do it.

    Yes, TDWTF is mandatory reading for any professional :)

  • (disco)

    TRWTF is 12 space indents.

  • (disco)

    Hey, at least this structure is infinitely extensible!

    if ( turtle) { if ( turtle) { if ( turtle) { if ( turtle) { ... ... ... return (allthewaydown.txt) } ... ... } } }

  • (disco) in reply to cellocgw

    :facepalm:

    just.... just :facepalm:

  • (disco) in reply to VinDuv
    VinDuv:
    That sounds27 familiar18…
    Ah, the joys of Discourse's idiotic click counters.
  • (disco) in reply to accalia

    Hey now, that was funny.

  • (disco) in reply to VinDuv
    VinDuv:
    That sounds familiar…
    That sounds32 familiar21…
    Zylon:
    VinDuv: That sounds27 familiar18…

    Ah, the joys of Discourse's idiotic click counters.

    Hmm, only happens when I copy-paste. Apparently using the Quote tool "works just fine". :white_check_mark:

  • (disco) in reply to cellocgw

    You gave up after finite tries?

    while (turtle); return (notallthewaydown.txt);

  • (disco) in reply to xaade
    xaade:
    You gave up after finite tries?

    while (turtle); return (notallthewaydown.txt);

    hmmm......

  • (disco) in reply to discoursebot

    Wouldn't it be more appropriate to use the "minutes" unit? Or even seconds?

  • (disco) in reply to xaade
    xaade:
    while (turtle); return (notallthewaydown.txt);
    But you got rid of the nested statements. This is the proper way:
    template <int i = 0>
    bool isTurtlesAllTheWayDown()
    {
        if (turtlesHere(i) {
            return isTurtlesAllTheWayDown<i+1>();
        } else {
            return not true;
        }
    }
    

    Filed under: If C macros were recursive, it would be not only infinite buttembly but also infinite source file

  • (disco) in reply to Gaska

    Wait. If I understand C++ templates.... that won't finish compiling.

    Because it has to make an instance of the function for every possible content of the <>.

  • (disco) in reply to xaade

    that is a malformed template, sure.

    it won't complete compiling successfully ever, but it may eventually complete with error.

  • (disco) in reply to accalia

    Actually, assuming you're not targetting abstract Turing machine, I think it should stop at 4294967296th specialization, which shouldn't be outside of today's computers reach. Can't test right now though.

    Also, I would nominate you two for not getting the joke badge if I knew how.

  • (disco) in reply to Gaska

    flag as notify moderators and mention the badge you are flagging for.

    of course there's the possiblility we got the joke and decided to play along rather than calling you out on it. :smiley: i know that's what i was doing (although the mods might disagree)

  • (disco) in reply to accalia
    accalia:
    of course there's the possiblility we got the joke and decided to play along rather than calling you out on it. i know that's what i was doing (although the mods might disagree)
    It would be more believable if you hearted my post.
  • (disco) in reply to Gaska

    maybe. like i said the mods might disagree with my assertion that i got the joke.

  • (disco) in reply to xaade
    Comment held for moderation.
  • (disco) in reply to PJH

    No wonder it takes so long. If no inlining would be done, the executable would be in tens of gigabytes. Still, gonna do some more testing tomorrow. On short int.

  • (disco) in reply to Gaska

    short unsigned int. The signedness means technically, instantiating your template causes UB. Probably would come out working the way you expect, but using unsigned will make sure.

  • (disco) in reply to EvanED

    On x86, it is de facto implementation-defined rather than undefined - and implementations define it as "treat signed overflow the same as unsigned overflow".

  • (disco) in reply to Gaska

    That's probably true during template instantation, but considering what goes on in optimization with normal code (where it is most definitely not treated as defined, wraparound behavior) I don't see why you'd pick the one with actually-defined behavior when it doesn't really have any downsides for your experiment. Sort of a "I type ++i for iterators because maybe, in some cases, the optimizer will be dumb even though it probably won't" kind of thing.

  • (disco) in reply to EvanED
    EvanED:
    *Probably* would come out working the way you expect,

    I'd be very surprised if it didn't come out working the way I expect...

    I'd fully expect it to not get as far as compiling, and I'd be very surprised at any other outcome...

  • (disco) in reply to EvanED
    EvanED:
    considering what goes on in optimization
    This experiment **won't** work with optimizations enabled. Template function calls will get inlined, impossible paths will be cut, tail call optimization will kick in, and the only leftover will be infinite loop doing nothing. -O0 is the only option (pun not intended).

    Anyway, the reason why I wrote short int and not unsigned short int is because it was 1AM.

    PJH:
    I'd fully expect it to not get as far as compiling
    Why? The code is valid C++. The only reason why it doesn't compile is because of compiler limitations. It will overflow stack and crash at runtime, however - but that's too just platform limitations and not because of invalid code.
  • (disco) in reply to Gaska
    Gaska:
    The code is valid C++.

    Really?

    Let me know which section of the C++ standard allows for ∞ to be stored in an int, and I may concede the point.

  • (disco) in reply to PJH

    doesn't it only specify the minimum size for an int? No maximum, therefore ℵ0 is an acceptable value

  • (disco) in reply to Jaloopa
    Jaloopa:
    doesn't it only specify the minimum size for an int? No maximum, therefore ℵ0 is an acceptable value
    <limits.h> specifies the largest (positive and negative) values an int may hold.

    [lib.numeric.limits] describes has_infinity and indicates that it is true only for floating point types (and the only other specialisation given is for bool, for which it is, obviously, FILE_NOT_FOUND.)

  • (disco) in reply to PJH

    I stand corrected. Luckily, I've never had to delve too deep into the inner workings of C++

  • (disco) in reply to Jaloopa
    Jaloopa:
    I stand corrected. Luckily, I've never had to delve too deep into the inner workings of C++

    The Standard's aren't exactly riveting reading....

  • (disco)
    PJH:
    Let me know which section of the C++ standard allows for ∞ to be stored in an int, and I may concede the point.
    §4.7.3 "If the destination type is signed, the value is unchanged if it can be represented in the destination type (and bit-field width); otherwise, the value is implementation-defined."
  • (disco) in reply to PJH

    limits.h is only valid for the architecture it's compiling for. there are different values for 32, 64 and 128 bit compilers (yes we do have a few 128 bit processors. they cost as much as a vintage mustang in mint condition but they do exist)

    so one could expand that to a thoretical infinite bit computer....

    of course we probably couldn't build the sucker, but we can theorize about it and, more importantly, implement a C compiler for it.

  • (disco) in reply to accalia
    Comment held for moderation.
  • (disco) in reply to xaade

    floating point numbers make provisions for non number values in their ISO spec. integers don't. they are simply numbers stored as 2's compliment values (for signed numbers) there is no "not a finite number" value there.

    i can look up chapter and verse if you want, but it's lunch hours. i'd much rather work on sockbot.

  • (disco) in reply to PJH
    Comment held for moderation.

Leave a comment on “Brick by Brick”

Log In or post as a guest

Replying to comment #:

« Return to Article