How do I implement no-op macro in C++?
#include
#ifdef NOOP
#define conditional_noop(x) what goes here?
#else
#
Like others have said, leave it blank.
A trick you should use is to add (void)0 to the macro, forcing users to add a semicolon after it:
#ifdef NOOP
#define conditional_noop(x) (void)0
#else
#define conditional_noop(x) std::cout << (x); (void)0
#endif
In C++, (void)0 does nothing. This article explains other not-as-good options, as well as the rationale behind them.