• Frist (unregistered)

    CHashMap comments; comments.addItem("", "frist")

  • Guest (unregistered)

    Comment held for moderation against its will at a secret blacksite.

  • (nodebb)

    Somehow I can feel the urge to search CHashMap for a char *operator &() member function...

    Or an overloaded version of AddItem that does something similar to that when you give it a CHashMap by pointer instead of a char *.

  • (nodebb)

    I'd also like to point out that in almost every possible circumstance, operator &() is more WTF than anything else you can do with C++.

  • dpm (unregistered) in reply to Steve_The_Cynic

    Bah. The only urge I feel is to stop reading TDWTF because this is just too painful to read. Literally painful.

    Don't get me wrong, it's an excellent article that fully meets the criteria for the site . . . but I'm hitting myself over and over again and wondering why it hurts.

  • Matt (unregistered)

    Not so Brian’s co-worker, Dagny. Dagny wanted to write some C++, but didn’t want to learn that pesky STL or have to master templates.

    Templates are fine and all, but in fairness mastering them presumably involves the single most Lovecraftian region of technical complexity in a mainstream language - template metaprogramming.

  • Object delete. (unregistered)

    Why did I read CrashMap?

  • BeeKay (unregistered)

    Extra added WTF is storing monetary values in a double!!

  • ooOOooGa (unregistered)

    hammer/foot-gun: n. A multipurpose tool suitable for hitting yourself in the head and shooting yourself in the foot at the same time.

  • ooOOooGa (unregistered)

    Dagny: "Hey, Brian. Maybe you can help me out with this. I keep hitting myself in the head, but I can't figure out why my foot hurts."

  • ZB (unregistered)

    "Dagny also considered themselves a “performance junkie”,"

    Apparently Dagny is some manner of gestalt organism.

  • Peter (unregistered)

    In all fairness, std::unordered_map is a fairly new addition to the language (C++11), so it's not uncommon to find variants of "CHashMap" in older codebases. But hopefully most of them are better written than this one.

  • (nodebb)

    Almost as bad as using a dynamically-typed language!

  • (nodebb)

    it’s worth mentioning that our DB stores dates in the typical format: “YYYY-MM-DD hh:mm:ss”. cvtUTC is a function that converts a date-time string to a time_t value, and FormatTime converts a time_t to a date-time string.

    How else are you transpose the string value?????

  • (nodebb) in reply to Steve_The_Cynic

    "operator &() is more WTF than anything else you can do with C++."

    That can actually be useful....MANY bigger WTF's are possible...... Uh On...here come those flaming nasal demons again...

  • foobar (unregistered)

    This code feels waayyy to familiar to be comfortable.

    Except the variant I know also added persistence to disk (why only crash once if the corruption can crash the next twenty versions too?!), and uses C-style casts instead of somewhat type-safe converter functions.

  • code_goddess (unregistered) in reply to Object delete.

    You're not alone in struggling to parse it, I thought someone had badly misspelled "cache".

  • Rgj (unregistered)

    Nobody even mentions the amountDue += 0;

  • (nodebb) in reply to TheCPUWizard

    I agree that there are some specific cases where operator &() works out OK (Microsoft's ATL COM pointer wrappers spring to mind), but I've seen it used in some other cases where ... stuff ... happened, and it was monstrously hard to work out why.

    Case in point: someone created a buffer-containter object. He thought it was a good idea to have an operator &() on the object that returned a char * that pointed to the contained buffer. I used the object in an innocuous situation, and the compiler barfed about 10K of error message owing to an unexpected change in pointer type deeeeeeeeeep in the bowels of the STL. Sadly, the guy worked in the office on the other side of the Atlantic from me, or I'd have gone to visit him with a Big Stick, and I wouldn't have bothered to speak softly either.

  • 04012018 (unregistered) in reply to kbielefe

    At least dynamically-typed languages have types. This is just cramming everything into one type, the so-called "stringly typed" approach.

  • Duck, The Type (unregistered)

    Static inferred typing: It's a duck if and only if the system knows it to be a duck. Agree or Duck off.

    Static explicit typing: It's a duck if and only if you have declared it to be a duck. Ducklare or Duck off.

    Dynamic typing: It's a duck if it walks and talks like a duck. Duck the Ducklarations.

    Stringy typing: It's a duck as long as you think it's a duck. What The Duck!

  • Mike Rosoft (unregistered) in reply to Object delete.

    Wait, the article's title isn't "CrashMap"?

  • (nodebb)

    Look(); Look(); CHashMap(); CHashMap(); Run();

    (Evil snickering)

  • bobcat (unregistered)

    You know a WTF is a good one when it also monkeys about with time/date for no good reason.

  • PITA (unregistered) in reply to dpm

    That is not the keyboard's intended use

  • o11c (unregistered) in reply to Steve_The_Cynic

    operator& and operator, are pretty tame in comparison to operator|| and operator&& which are no longer short-circuiting.

  • beef (unregistered)

    Why is the syntax highlighting so bad?

Leave a comment on “CHashMap”

Log In or post as a guest

Replying to comment #495973:

« Return to Article