2 ms·
In support of tptacek's comment, an abbreviate version of what's in assert.h on my OSX system: #ifdef NDEBUG #define assert(e) ((void)0) #else #defi
by scott_s 15y ago
In support of tptacek's comment, an abbreviate version of what's in assert.h on my OSX system:
#ifdef NDEBUG
#define assert(e) ((void)0)
#else
#define assert(e) \
((void) ((e) ? 0 : __assert (#e, __FILE__, __LINE__)))
#define __assert(e, file, line) \
((void)printf ("%s:%u: failed assertion `%s'\n", file, line, e), abort())
So, if NDEBUG ("no debug") is defined, which it is if optimizations are turned on, asserts become a no-op.