Newsgroups: comp.lang.c Path: utzoo!utgpu!watserv1!watmath!datangua From: datangua@watmath.waterloo.edu (David Tanguay) Subject: Constants in conditionals, was Re: Are enums safe to use in portable code? Message-ID: <1991Feb18.113919.28217@watmath.waterloo.edu> Organization: University of Waterloo References: <9890@dog.ee.lbl.gov> Date: Mon, 18 Feb 1991 11:39:19 GMT Lines: 10 In article <9890@dog.ee.lbl.gov> torek@elf.ee.lbl.gov (Chris Torek) writes: >Both of these are effectively the same as `if (0)', hence a good compiler >should warn about a constant in conditional context [...] Oooo I hope not! I occasionally use constants in ifs. "if( PATCH_MODE ) { ... }", where PATCH_MODE is a cpp macro (0 or 1). I know I coud use #if (or #ifdef), but I find them too ugly. I could also use an external, but then I don't get the dead code elimination. -- David Tanguay Software Development Group, University of Waterloo