Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!shelby!agate!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Constants in conditionals Message-ID: <10032@dog.ee.lbl.gov> Date: 19 Feb 91 09:33:19 GMT References: <9890@dog.ee.lbl.gov> <1991Feb18.113919.28217@watmath.waterloo.edu> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 16 X-Local-Date: Tue, 19 Feb 91 01:33:19 PST >In article <9890@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@watmath.waterloo.edu> datangua@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@ee.lbl.gov