Path: utzoo!utgpu!cunews!cognos!geovision!pt From: pt@geovision.gvc.com (Paul Tomblin) Newsgroups: comp.lang.c Subject: Re: Constants in conditionals Message-ID: <1427@geovision.gvc.com> Date: 22 Feb 91 16:59:46 GMT References: <1424@geovision.gvc.com> <23253@well.sf.ca.us> Reply-To: pt@geovision.gvc.com Organization: GeoVision Corp., Ottawa, Ontario Lines: 31 jef@well.sf.ca.us (Jef Poskanzer) writes: >In the referenced message, pt@geovision.gvc.com wrote: >}Sorry, but #ifdef or #if is SOOO basic, that if you don't know how to use >}it (or refuse to for wierd reasons), you loose. >Using "if" for conditional compilation instead of "#if" has one major >advantage: the outshipped code continues to get checked for syntax >errors. For machine-dependent code you probably don't want this, >otherwise you probably do. But you're right, you do have to check >the generated assembly code to make sure your compiler is doing >the right thing. These days, most do. I think you'd be making a mistake in assuming that because code still compiles without error that it is still correct. "If it's not exercised, it's not correct" is a good assumption that any future maintainer of the code would have to make. Code around here that is "#if 0"ed out, is usually expunged the next time a bug shows up it that area of code. If it's "if (FALSE)"ed out, it will be expunged the first time it's spotted. (And the coder will get a talking to! PCC doesn't do the right thing.) We use #ifdef for two reasons: Machine dependant code, and debugging. When trying out new things, or temporarily removing something to try another approach, we tend to put in #ifdefs, but we try and remove them when we are done. Anything else is asking for maintainence headaches. (I know, I'm in charge of maintainence!) -- Paul Tomblin, Department of Redundancy Department. ! My employer does The Romanian Orphans Support Group needs your help, ! not stand by my Ask me for details. ! opinions.... pt@geovision.gvc.com or {cognos,uunet}!geovision!pt ! Me neither.