As I understand, whenever the compiler is building in release mode, the macro NDEBUG
is defined, while in debug mode it isn't. That is how assert
knows when to work.
What I've noticed though is that with the MSVC compiler (2015), NDEBUG
is never defined, regardless of the build mode.
Anyway, _DEBUG
is defined. Is this macro standard C++ or some MSVC thing? Should I use it if I'm aiming for compatibility? Does it work with other compilers? (couldn't check) Thanks!