(C++) NDEBUG

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) NDEBUG

 

#define NDEBUG to let the preprocessor remove all asserts from your code.

 

The code below has a failing assert, but due to NDEBUG it will not abort the program. Commonly, one #defines NDEBUG after debugging.

 


#define NDEBUG #include <cassert> int main() {   assert(1==2); //Nonsense }