assert.3: Clarify details of message printed by assert()

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-06-03 06:36:43 -05:00
parent 4d644289dd
commit 9b3661c406
1 changed files with 14 additions and 7 deletions

View File

@ -38,14 +38,21 @@ assert \- abort the program if assertion is false
This macro can help programmers find bugs in their programs,
or handle exceptional cases
via a crash that will produce limited debugging output.
The function will print an error message to standard error
(e.g., "assertion failed in file foo.c, function do_bar(), line 1287")
and terminate the program by calling
.BR abort (3)
if
If
.I expression
is false (i.e., compares equal to zero).
.LP
is false (i.e., compares equal to zero),
.BR assert ()
prints an error message to standard error
and terminates the program by calling
.BR abort (3).
The error message includes the name of the file and function containing the
.BR assert ()
call, the source code line number of the call, and the text of the argument;
something like:
prog: some_file.c:16: some_func: Assertion `val == 0' failed.
If the macro
.B NDEBUG
is defined at the moment