Re: #defining a comment
On 2006-06-05 17:03, hobbes_7_8@yahoo.com wrote:
Hi everybody!
This is basically a pre-processor doubt. I have this very simple
define:
#ifdef NDEBUG
#define QTRACE //
#else
#define QTRACE qDebug()
#endif
... so that the line:
QTRACE << "Foi lido o valor" << *it;
... is expanded to:
qDebug() << "Foi lido o valor" << *it;
... in debug mode, and is expanded to:
// << "Foi lido o valor" << *it;
... in release mode. Unfortunately compilation yields:
main.cpp(17) : error C2143: syntax error : missing ';' before '<<'
... Meaning the pre-processor expanded the macro to absolutely nothing
:( Does anyone know a way to overcome this? I'm developing this on
Visual Studio .NET 2003 but it will run on a HP-UX system, so I can't
rely on any Microsoft extension.
I'm not really sure since I seldom use macros but I think that the // is
treated as a comment by the preprocessor. Try #define QTRACE \/\/.
Erik WikstrFm
--
"I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure
out how to use my telephone" -- Bjarne Stroustrup