Where can I find C++ code for debugging macros like TRACE, DEBUG and
etc. that are independent of any proprietary code. I rather not have
to reinvent the wheel.
In the mean time, I'm trying to define a TRACE macro like this:
#ifdef DEBUG
#define TRACE(arg) cout << (arg)
#else
#define TRACE(arg)
#endif
For example:
TRACE("Hello world!");
It seems to work but is this the best way? I'm not sure about the
empty define statement. I've seen third party code use a "(void)0"
construct instead of an empty define stement. Which is the correct or
best way? I want the code completely removed when DEBUG is not
defined (Of course, the only thing left would be the simicolon ";"
after the TRACE stement.)