Synopsis
#define assert(e) ...
Description

If NDEBUG is defined as a macro name at the point in the source file where <assert.h> is included, the assert macro is defined as:

#define assert(ignore) ((void)0) 

If NDEBUG is not defined as a macro name at the point in the source file where <assert.h> is included, the assert macro expands to a void expression that calls __assert.

#define assert(e) ((e) ? (void)0 : __assert(#e, __FILE__, __LINE__)) 

When such an assert is executed and e is false, assert calls the __assert function with information about the particular call that failed: the text of the argument, the name of the source file, and the source line number. These are the stringized expression and the values of the preprocessing macros __FILE__ and __LINE__.

Note

The assert macro is redefined according to the current state of NDEBUG each time that <assert.h> is included.