The busy work of __saving US from OurSelves

What do BOOL, Bool, BOOLEAN, LOGICAL, TRUTH, and even (God help me) CHOICE have do to with each other? Where did CHAR, Char, _char, SCHAR, UCHAR, BYTE, SBYTE, UBYTE, CHARACTER, TCHAR, _TCHAR, _CHAR, _T, _C, CHR, and GLYPH come from? Do we use DWORD, ULONG, INT, Int, NUM, or (hey, I know it’s a stretch) int for that ten-element-array index?

I’m sorry, I said array. I really meant PCTSTR, or possibly UBYTE[].  (The last time I gave this talk, someone in the audience cried out “foo::ptr_type” and then got beaten up by a bunch of XML guys who’d wandered into the wrong lecture.  It happens.  I have to admit, it’s even enjoyable).

I love porting surfaces. Spartans aside, there’s nothing like sticking two libraries with conflicting ideas of BOOL into a bottle and watching fur fly (“In this corner, Ladies and Gentlemen, BOOL is wearing the mask of a UCHAR, in the otherrrr it’s a ULONG for some Godforsaken reason”). The types circle each other for a while, then pounce.  After a while the inside of the glass gets pretty well coated and you can barely make out what’s going on inside. Welcome to my life.

A lot of this stems from the phase of a project where some people feel the uncontrollable urge to type something. Rather than (say) write documentation, they write useless source code. It’s easy to justify this kind of crap because it’s fear-based. “I’ll isolate the entire project from evil ints and characters; let’s have a portability layer over stuff that the language standard guarantees, because you never know when space aliens are going to come along and suddenly make all of your ints 17 bits, your characters six-and-a-half (with parity), and turn your pointers into obliterating agents of chaos should you even think of treating them as longs. Sorry, I mean IntPtrs.

“Super Type Defender Man is here to savvveee you! No, don’t thank me, find your local ANSI committee reps and thank them. Now my work here is DONE. Or Done. Or maybe it’s __finished…”

Author: landon

My mom thinks I'm in high tech.

One thought on “The busy work of __saving US from OurSelves”

Leave a Reply

Your email address will not be published. Required fields are marked *