assert(3) CLIX assert(3)
NAME
assert - Verifies program assertion
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <assert.h>
assert(
int expression );
PARAMETERS
expression Specifies a C Language expression.
DESCRIPTION
This macro is useful for putting diagnostics into programs. When it is
executed, if expression is false (zero), assert() displays
Assertion failed: expression, file xyz, line nnn
on stderr and aborts. In the error message, xyz is the name of the source
file and nnn the source line number of the assert() statement.
Compiling with the preprocessor option -DNDEBUG (see cpp(1)), or with the
preprocessor control statement
#define NDEBUG
ahead of the #include <assert.h> statement, stops assertions from being
compiled into the program.
Since assert() is implemented as a macro, the expression may not contain
any string literals.
EXAMPLES
To use assert with a C expression:
assert(number=atoi(argv[1]))
RETURN VALUES
None
2/94 - Intergraph Corporation 1
assert(3) CLIX assert(3)
RELATED INFORMATION
Commands: cpp(1)
Functions: abort(3)
2 Intergraph Corporation - 2/94