HP C/iX Library Reference Manual (30026-90004)
108 Chapter5
HP C/iX Library Function Descriptions
assert
assert
Terminates the program if the assertion is false.
Syntax
#include <assert.h>
void assert (int
expression
);
Parameters
expression
An integer value to be evaluated.
Return Values
None.
Description
The assert macro terminates the program if the assertion is false. The assert macro
takes a single integer (expression) argument. If the expression evaluates to 0 (false),
assert() writes a message containing the expression that tested false and the line
number where the assert occurred. The program then terminates. The macro NDEBUG is
referenced but not defined in <assert.h>. If NDEBUG is defined at the point when
<assert.h> is included, the assert macro calls have no effect. The NDEBUG macro enables
the operation of the assert macro:
See Also
abort(), ANSI C 4.2.1.1, POSIX.1 8.1
NDEBUG Definition assert macro effect
Defined Calls are ignored (no debugging done)
Undefined Calls are processed (debugging is done)