Wandering Thoughts archives


The problem with #ifdef

Something that crystallized in the process of writing the earlier Bourne shell quoting entry is that #ifdef abuse leads to bad results for the same fundamental reason that multiple levels of escaping are bad: after a certain point, people can no longer clearly see what the real code will look like.

When you can't see what the code looks like, it's really hard to make sensible changes; either you make blind stabs or you have to carefully reconstruct the actual code, usually by hand. Either process is error prone, and it's easy to fool yourself, and you are effectively doing remote control programming (with mushy feedback).

Ironically I suspect that the really dangerous #ifdef'd code is not the code that is completely snarled up, but the code that is halfway there. Code that is a complete mess is clearly beyond understanding, but code that is only half-overgrown with #ifdefs tempts you into thinking that you can follow it when you actually can't.

(The worst #ifdef'd code that I've personally encountered and haven't frantically scrubbed out of my brain is the xterm code, which is a shining example of what not to do to make a portable program.)

programming/IfdefProblem written at 23:48:25; Add Comment

A thought of the day

Something that occurred to me not too long ago:

Once you start thinking of furniture as a type of computer hardware, it becomes much easier to talk yourself into buying a decent desk chair.

In some sense it is completely absurd how many computer people are willing to pay several hundred dollars for a good monitor (LCD or CRT), but will balk at spending even a hundred dollars for a comfortable chair. (In another sense, it is very human; we're not exactly entirely rational creatures.)

FurnitureThought written at 16:48:24; Add Comment

Link: A lovely summary of the XHTML issue

On the WHATWG mailing list, Henri Sivonen put together a marvelous and concise summary of the whole problem with XHTML in today's world, and why XHTML advocates usually irritate me. I'm not going to quote anything; just read the whole thing here.

(From Sam Ruby, who linked to an Ian Hickson WHATWG mailing list message that quoted Henri Sivonen's message.)

links/XHTMLInANutshell written at 16:00:54; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.