Mail Archives: djgpp/1993/07/06/22:12:08
Yes,
#if(TRACE)
// code you only want some of the time
#endif
IS obvious.
However, I once had a fairly complicated interactive program which
I debugged in two stages:
Stage 1: Use the *variable* TRACE to interactively turn on tracing
when something strange happened.
Stage 2: Comment out the the declaration of TRACE and use the
*macro* TRACE to determine whether debugging code was
included (Zortech C/C++ *does* eliminate such dead code).
This was done to make sure that old modules weren't broken
as new ones were added and induced erratic behavior in the
system.
Since there were lots of places where the TRACE switch was used, it would
have been very inconvenient to change from `if(TRACE){}' to `#if(TRACE)
... #endif'.
So if GNU C/C++ does *not* eliminate this dead code, I would consider
it a misfeature.
--Steve
- Raw text -