1 /* The <assert.h> header contains a macro called "assert" that allows
2 * programmers to put assertions in the code. These assertions can be verified
3 * at run time. If an assertion fails, an error message is printed and the
5 * Assertion checking can be disabled by adding the statement
9 * to the program before the
23 /* Debugging disabled -- do not evaluate assertions. */
24 #define assert(expr) ((void) 0)
26 /* Debugging enabled -- verify assertions at run time. */
28 #define __makestr(x) # x
29 #define __xstr(x) __makestr(x)
31 _PROTOTYPE( void __bad_assertion
, (const char *_mess
) );
32 #define assert(expr) ((expr)? (void)0 : \
33 __bad_assertion("Assertion \"" #expr \
34 "\" failed, file " __xstr(__FILE__) \
35 ", line " __xstr(__LINE__) "\n"))
37 #define assert(expr) ((void) ((expr) ? 0 : __assert( __FILE__, __LINE__)))