assert (3)
Leading comments
Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) %%%LICENSE_START(VERBATIM) Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this on...
NAME
assert - abort the program if assertion is falseSYNOPSIS
#include <assert.h> void assert(scalar expression);
DESCRIPTION
If the macro NDEBUG was defined at the moment <assert.h> was last included, the macro assert() generates no code, and hence does nothing at all. Otherwise, the macro assert() prints an error message to standard error and terminates the program by calling abort(3) if expression is false (i.e., compares equal to zero).The purpose of this macro is to help programmers find bugs in their programs. The message "assertion failed in file foo.c, function do_bar(), line 1287" is of no help at all to a user.
RETURN VALUE
No value is returned.ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).Interface | Attribute | Value |
assert() | Thread safety | MT-Safe |