Wouldn’t this be nice.

While many people resort to logging for efficient debugging, writing everything to stdout might not be the best thing, especially with cout.

In my perfect world, I’d love to do this:


using namespace std;
#define __DEBUG
#ifdef __DEBUG
#define LOGME cout
#else
#define LOGME //
#endif

int main()  {
  LOGME << "Hello world";
}

But sadly, comment marks are excluded from preprocessors.

0 Responses to “Wouldn’t this be nice.”


  1. No Comments

Leave a Reply