4 ms·
I don't quite understand these lines: #define ; #define do I was under the impression it was "#define CNAME value" – what does it mean when there is
by ARandomerDude 5y ago
I don't quite understand these lines:
#define ;
#define do
I was under the impression it was "#define CNAME value" – what does it mean when there is no value? A trip to Google didn't turn up anything for me, so I'm wondering if a C master can weigh in. Thanks!
- cperciva 5y agoIt 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.
- asveikau 5y agoOf 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.