expressions and #if

Dave Brownell brownell at harvard.ARPA
Mon Jul 16 20:45:09 AEST 1984


Contrast smarter and smarter CPP constant evaluation with the approach
taken in Ada, which is to insist that the compilers optimize out unreachable
code.  I frankly prefer this;  contrast

    #ifdef	FEATURE
	if (not_otherwise_indicated()) {    /* el hacko gross-me-out */
    #endif	FEATURE
	process ();
	...
    #ifdef	FEATURE
	}
    #endif	FEATURE

(which I have seen in some System V code, by the way) with code like

    if (FEATURE == disabled || not_otherwise_indicated()) {
	process ();
    }

I don't think I'm alone in preferring the second option.  In heavily
parameterized with #ifdefs or #ifs this seems sooo much more readable ...

Thoughts/flames, anyone ???


Dave Brownell
{allegra,floyd,ihnp4,seismo}!harvard!brownell



More information about the Comp.lang.c mailing list