[prev] [index] [next]

Variations (cont)

Downsides of using cpp-based conditional compilation:
  • code becomes large and difficult to read
  • program changes when compiled with different switches
Example where program change is problematic:

#ifdef DEBUG
printf(...)
#endif
vs
enum {DEBUG = 0};
...
if (DEBUG) {
    printf(...)
}