Click to See Complete Forum and Search --> : Is it possible to do macro...


April 30th, 1999, 12:17 PM
I want to do 2 macros... the first one will be called:

#define BEGIN_DEBUG

and the second will be called:

#define END_DEBUG

The goal is when i'm in debugging mode i want be abl to do things like that:


BEGIN_DEBUG
{
// Some c++ code...
}
END_DEBUG

But when i'm in release mode this block of code must disapears..

Is this possible?
If it is ... whats the trick?

Tanks.

Reply to : forgete@actresearch.com

LALeonard
April 30th, 1999, 12:46 PM
Two tricks:

1). Use the _DEBUG macro that is already defined by the compiler:

#ifdef _DEBUG
DoVeryLongAndBoringTest();
EvenMoreSlowDebugging();
#endif

2). If it's only going to take one line of code, do this:

DEBUG_ONLY(AfxMessageBox("Got this far without crashing!"));

HTH.

LA Leonard - http://www.DefinitiveSolutions.com