I'm building a library that was originally written to be compiled with gcc (I'm using MSVC). Most of the functions look something like this:-
I looked through the header files and discovered that one of them re-defines DEBUG - like so:-Code:void the_function_name ()
{
assert ( <whatever> );
if (DEBUG (BUFFER)) {
// Dump some Debug information
}
// Rest of the function
}
If I build a Debug version I see the expected warning from MSVC:-Code:#define DEBUG_LEVEL(WHAT, LEVEL) (_hb_debug ((LEVEL), HB_DEBUG_##WHAT))
#define DEBUG(WHAT) (DEBUG_LEVEL (WHAT, 0))
That in itself doesn't worry me unduly. What worries me more is that there's no guard around the above re-definition. So I'm worried in case DEBUG will now be defined for my Release builds as well as my Debug builds. I contacted the author who said that this won't happen because the compiler will optimize everything away when building a Release version. Does anyone know if that's true, either for gcc or MSVC?Quote:
warning C4005: 'DEBUG' : macro redefinition