What does this C++ define macro do?

Advertisements

What does this define macro do? I assumed that this will print the given string to the standard output, but it just not printed out nothing. Am I wrong about this?

#define SCOPE_LOGGER(...)
...
void someClass::someFunction() { SCOPE_LOGGER("someClass::someFunction()"); ... }

>Solution :

As per KamilCuk’s answer, that macro expands to nothing.

However, most likely it does expand to something through some other preprocessing conditional path, i.e. imho that line appears in the code like this:

#ifdef DEBUG
#define SCOPE_LOGGER(...) something real that does the logging
#else
#define SCOPE_LOGGER(...)
#endif

That’s the only way that line can make sense.

Leave a Reply Cancel reply