On Thu, Apr 24, 2014 at 04:45:00PM +1000, Peter Crosthwaite wrote:
> Convert conditional compilation of debug printfs to regular ifs.
> 
> good:
> 
> #ifdef DEBUG_FOO
> #define DEBUG_FOO 0
> #endif
> 
> #define DB_PRINTF \
>   if (DEBUG_FOO) { \
>      fprintf(...) \
>   }
> 
> bad:
> 
> #ifdef DEBUG_FOO
> #define DB_PRINTF
>      fprintf(...) \
> #else
> #define DB_PRINTF do { } while(0);
> #endif
> 
> The reasoning is so that debug messages and their formats will always
> be compile tested regardless of whether they are wanted at run time.

Yes, please!  There are many files that use the "bad" approach and can
be easily converted.

Stefan

Reply via email to