RE: Windows question

From: Neil Bradley <neil_at_synthcom.com>
Date: Thu Jul 22 1999 - 13:40:17 EDT

> which now I can see introduced a precedence problem (0xf8 != VERSION)
> the moral of the story is "double check your macros"

And two additional morals:

* Parenthesize *EVERYTHING* when you're writing a macro
* When in doubt, parenthesize

Bugs like this can lay dormant for eons, and are REALLY nasty to find.
Here's another good one:

#define DO_SOMETHING(x) x = y; y=2; y =x;

...

        if (blah)
                DO_SOMETHING(blah)

I now religiously put braces on all if statements even if there's only one
line of code beyond it, and I always put braces around blocks of code
defined by macros.

-->Neil

-------------------------------------------------------------------------------
Neil Bradley Synthcom home : http://www.synthcom.com
Synthcom Systems, Inc. Search for Extraterrestrial Intelligence on your
ICQ # 29402898 computer! http://setiathome.ssl.berkeley.edu/
Received on Thu Jul 22 12:26:28 1999

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2003 - 00:31:28 EDT