mirror of https://github.com/mkerrisk/man-pages
assert.3: Clarify details of message printed by assert()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
4d644289dd
commit
9b3661c406
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue