From 9b3661c406a602b6ba734bfe3a0ed59aa0e9c457 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 3 Jun 2016 06:36:43 -0500 Subject: [PATCH] assert.3: Clarify details of message printed by assert() Signed-off-by: Michael Kerrisk --- man3/assert.3 | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/man3/assert.3 b/man3/assert.3 index af3509004..8833d29ce 100644 --- a/man3/assert.3 +++ b/man3/assert.3 @@ -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