Archive for 26th June 2008

#ifdef or #if defined?

One of my co-workers discovered an interesting item in the #ifdef/#ifndef entry of the help files for Microsoft Visual C++ 2005:

These directives are provided only for compatibility with previous versions of the language. The defined( identifier ) constant expression used with the #if directive is preferred.

(Update: The same statement is in the help file for Visual C++ 2003. I don’t know about Visual C++ 6.0, the version immediately prior to the 2003 release.)

Preferred by whom? And why?

The two are practically identical in use, and I tend to use both — “#if defined” is good for testing multiple things on a single line (combined with && or ||), “#ifdef” is more concise when you only need to test one thing (which is usually the case). So what’s the reason to “prefer” one over the other? A ‘net search doesn’t turn up any indication of one.

Microsoft doesn’t control either the C or C++ standards, so they can’t remove #ifdef from them. They also can’t unilaterally remove it from the compiler without irritating practically all of their customers (which they really can’t afford to do any further). Where do they get off claiming that one is “preferred”? It sounds to me like the kind of playground-bully attitude that Microsoft has become infamous for.

Paper Spam!

A friend of mine noticed that an envelope had been slid under his apartment door yesterday, containing a hand-written note:

Hi! Every time I see you I think how beautiful and georgious you are and want to get to know you better. Don’t get me wrong, I just want to be your friend. If you are interested, I am your neighbor. My name is Travis and my phone number is [removed to protect the not-so-innocent]. Call me!

My friend is most decidedly heterosexual, and says that he “could not shred the thing fast enough!” :-)

My first thought, on the other hand, was that the message was very generic and could have equally well been sent to anyone — the hallmark of spam. I imagined someone desperate writing these out in mass quantities and papering the entire building with them, floor by floor, relying on the statistical likelihood that someone would bite… I really should stay away from my spam folder. :-)