I would like to have a conditional print macro where I can toggle it on or off based upon whether a macro is defined, such as #define DEBUG
. My first thought was the following:
#define DEBUG_PRINT(...) #ifdef DEBUG printf(__VA_ARGS__) #endif
But this doesn't quite work and I get the following error when trying:
pc.c:16:24: error: '#' is not followed by a macro parameter
#define DEBUG_PRINT(...) #ifdef DEBUG printf(__VA_ARGS__) #endif
What would be a valid way to define something like a DEBUG_PRINT
macro which prints if a boolean value is turned on?