What is the difference between DEBUG and _DEBUG in vc++ in visual studio 2008.Is there any difference because in In my project,in some module preprocessor is DEBUG and in some module it is _DEBUG.
In your own code you can check for any macro you want, so it doesn't matter which one to use.
But the libraries you use may behave different. E.g. the MSDN documentation about assert
states:
Assertion statements compile only when _DEBUG is defined. When _DEBUG is not defined, the compiler treats assertions as null statements.
So I would suggest to always use _DEBUG
.
Edit: According to MSDN you do not even have to define any special debug macro because the compiler will do it for you as soon as you specify a debug runtime library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With