NAME
assert — insert
program diagnostics
SYNOPSIS
#include <assert.h> void assert(int expression);
DESCRIPTION
The assert() macro inserts diagnostics into programs. When it is executed, if expression is false (that is, compares equal to 0), assert() writes information about the particular call that failed (including the text of the argument, the name of the source file and the source file line number - the latter are respectively the values of the preprocessing macros __FILE__ and __LINE__) on stderr and calls abort(3) .
Forcing a definition of the name NDEBUG, either from the compiler command line or with the preprocessor control statement #define NDEBUG ahead of the #include <assert.h> statement, will stop assertions from being compiled into the program.
RETURN VALUE
The assert() macro returns no value.
ERRORS
No errors are defined.
EXAMPLES
None.
APPLICATION USAGE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
abort(3) , stderr(3) , <assert.h> .
DERIVATION
Derived from Issue 1 of the SVID.