Pre-compile constants?

I prefer something like this so you can use #if DEBUG rather than #ifdef DEBUG:

#define DEBUG 1

This also allows you to do things like:

     if (DEBUG) {
        ...stuff...
     }
     if (DEBUG && packetIsV6(packet)) {
        pretteyPrint6(packet);
     }

Which will format better. And is still optimized away.
(oh - and you can easily convert it to being enabled/disabled at run-time)

2 Likes