|
NAMEassert —
expression verification macro
SYNOPSIS#include <assert.h>
DESCRIPTIONTheassert () macro tests the given
expression and if it is false, the calling process is
terminated. A diagnostic message is written to stderr
and the function
abort(3)
is called, effectively terminating the program.
If expression is true, the
The The EXAMPLESThe assertion:assert(1 == 0); Assertion failed: (1 == 0), function
main, file main.c, line 100. The following assert tries to assert there was no partial read: assert(read(fd, buf, nbytes) ==
nbytes); NDEBUG is defined, changing the semantics of the
program.
SEE ALSOabort2(2), abort(3)STANDARDSTheassert () macro conforms to ISO/IEC
9899:1999 (“ISO C99”).
HISTORYAnassert macro appeared in
Version 7 AT&T UNIX.
Visit the GSP FreeBSD Man Page Interface. |