/** * debug.c * * Debugging using the preprocessor. When DEBUG is set to 0, the LOG statements * are completely removed from the binary produced after compliation. * * Compile: * gcc -g -Wall -o debug debug.c */ #include /* What happens when we set DEBUG to 0? */ #define DEBUG 0 #define LOG(fmt, ...) \ do { if (DEBUG) fprintf(stderr, fmt, __VA_ARGS__); } while (0) int main(void) { int i = 6; LOG("Hello world! i = %d\n", i); return 0; }