Constants in conditionals, was Re: Are enums safe to use in portable code?

Paul Tomblin pt at geovision.gvc.com
Tue Feb 19 13:11:14 AEST 1991


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).
>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.

TOO UGLY!  Don't come applying for a job here!  Anybody who doesn't know
how to use all the BASIC aspects of the C compiler, and relys on optimizations
that probably aren't done on most of our machines (pcc based compilers) isn't
going to be too popular at this company, and probably many many others.

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.
-- 
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 at geovision.gvc.com or {cognos,uunet}!geovision!pt      ! Me neither.



More information about the Comp.lang.c mailing list