Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!think!ima!haddock!ico!dougm From: dougm@ico Newsgroups: net.lang.c Subject: Re: Orphaned Response Message-ID: <15300004@ico> Date: Sun, 29-Jun-86 12:32:00 EDT Article-I.D.: ico.15300004 Posted: Sun Jun 29 12:32:00 1986 Date-Received: Thu, 3-Jul-86 07:23:04 EDT References: <1063@watmath.UUCP> Lines: 30 Nf-ID: #R:watmath.UUCP:1063:ico:15300004:000:1018 Nf-From: ico!dougm Jun 29 12:32:00 1986 /* Written 1:46 pm Jun 27, 1986 by rbutterworth@watmath.UUCP in ico:net.lang.c */ /* ---------- "Re: #if foo vs #if defined(foo)" ---------- */ > A CPP which silently takes undefined symbols to be 0 can be quite > dangerous. Consider the following case with these definitions ... > "#if squat||(3*y)". > I think the effort of having to use "#ifdef x" or "#if defined(x)" > instead of lazily using "#if x" is well worth it. I have to agree. Another sloppy practice I've come across is not using the "&&" and "||" but using "&" and "|" as equivalent to the doubled form. Then you end up spending time searching for a problem when someone changes a #define token to #define token 2 and having the #if token&token2 suddenly not work. Using the defined(token) construct when you only care about defined or not defined can save more time than the time it takes to type it in. Of course, you still have the people who think that #ifdef token&token2 does the same thing as #if defined(token)&&defined(token2)