← Back to context

Comment by cperciva

4 years ago

It defines those to a value of "", effectively stripping them from the source code.

The most common place where this sort of thing occurs is the common idiom

    #ifdef DEBUG
    #define debug(...) realdebug(__VA_ARGS__)
    #else
    #define debug(...)
    #endif

which allows you to sprinkle debug() calls through your code and have them disappear if you compile without defining the macro DEBUG.

Of course for your quoted use it's more common to see:

    #define debug(...) ((void)0)

This forces you to use debug() as a statement. If no value is defined you could omit the semicolon on a debug() statement and it still compiles.