Constants in conditionals

Chris Torek torek at elf.ee.lbl.gov
Tue Feb 19 20:33:19 AEST 1991


>In article <9890 at dog.ee.lbl.gov> I wrote:
>>... these are effectively the same as `if (0)', hence a good compiler
>>should warn about a constant in conditional context [...]

In article <1991Feb18.113919.28217 at watmath.waterloo.edu>
datangua at watmath.waterloo.edu (David Tanguay) writes:
>Oooo I hope not! I occasionally use constants in ifs.
>"if( PATCH_MODE ) { ... }", where PATCH_MODE is a cpp macro (0 or 1).

Well, a *really* good compiler will allow you to say `yes, I know
this is a constant, but I want to test it anyway'.

(This is one possible use for an ANSI `#pragma'.)
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab EE div (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list