assert.h

The file assert.h defines the assert() macro. If the NDEBUG macro is defined, then assert does nothing. Otherwise, assert calls the auxiliary function _assert if the one macro parameter of assert evaluates to 0 (FALSE). See the following listing.

Listing: Use assert() to assist in debugging


#ifdef NDEBUG
  #define assert(EX)

#else

  #define assert(EX) ((EX) ? 0 : _assert(__LINE__, __FILE__))

#endif