Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DEBUG vs _DEBUG

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.

like image 937
Jitendra Avatar asked Oct 10 '11 06:10

Jitendra


1 Answers

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.

like image 186
Stephan Avatar answered Sep 21 '22 14:09

Stephan