Some code of VC++
-
What does the following code do????????? #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif NT
if _DEBUG has been defined elsewhre, it defeines DEBUG_NEW and undefines THIS_FILE, then sets it to the current file namae. It's not C++, it's nasty C preprocessor stuff. Avoid if you can.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
if _DEBUG has been defined elsewhre, it defeines DEBUG_NEW and undefines THIS_FILE, then sets it to the current file namae. It's not C++, it's nasty C preprocessor stuff. Avoid if you can.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
if _DEBUG has been defined elsewhre, it defeines DEBUG_NEW and undefines THIS_FILE, then sets it to the current file namae. It's not C++, it's nasty C preprocessor stuff. Avoid if you can.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Christian Graus wrote:
it's nasty C preprocessor stuff. Avoid if you can
:-D Maybe, but it's really handy for debugging MFC apps ;P
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
What does the following code do????????? #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif NT
For debug builds, it tells the compiler to use the crt debug "new" operator instead of the normal one. The debug version adds leak detection and maybe some other stuff. It also, as metioned, sets the THIS_FILE define to the current file. This information is used when dumping memory leak info. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder