The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 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().

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(), stderr , <assert.h>.

DERIVATION

Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]