C++ Primer says that
The behavior of assert depends on the status of a preprocessor variable named NDEBUG. We can "turn off" debugging by providing a
#defineto defineNDEBUG
It is my expectation that when define is provided, asserts won't be executed.
#define NDEBUG TRUE int main (int argc, char const *argv[]) { assert(argc==0); // checked return 0; } Why, in this example, is assert statement checked, when NDEBUG is defined? (Correct me if i am wrong, but it does not matter to what it is defined, right?)
When executed from command line, using the -DNDEBUG flag, all works as expected (assert is not executed)