From: Nikos Mavrogiannopoulos <nmav-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] assert.3: improved description
Date: Thu, 02 Jun 2016 11:07:31 +0200 [thread overview]
Message-ID: <1464858451.5804.3.camel@redhat.com> (raw)
Removed text referring to text not being helpful to users. Provide
the error text instead to allow the reader to determine whether it is helpful.
Recommend against using NDEBUG for programs to excibit deterministic behavior.
Moved description ahead of recommendations.
Signed-off-by: Nikos Mavrogiannopoulos <nmav-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
man3/assert.3 | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/man3/assert.3 b/man3/assert.3
index 7cf7328..1b85a68 100644
--- a/man3/assert.3
+++ b/man3/assert.3
@@ -24,6 +24,7 @@
.\"
.\" Modified Sat Jul 24 21:42:42 1993 by Rik Faith <faith-tsp8moGkja0@public.gmane.orgedu>
.\" Modified Tue Oct 22 23:44:11 1996 by Eric S. Raymond <esr@thyrsus.com>
+.\" Modified Thu Jun 2 23:44:11 2016 by Nikos Mavrogiannopoulos <nmav-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
.TH ASSERT 3 2015-08-08 "GNU" "Linux Programmer's Manual"
.SH NAME
assert \- abort the program if assertion is false
@@ -34,26 +35,26 @@ assert \- abort the program if assertion is false
.BI "void assert(scalar " expression );
.fi
.SH DESCRIPTION
+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
+.I expression
+is false (i.e., compares equal to zero).
+.LP
If the macro
.B NDEBUG
-was defined at the moment
+is defined at the moment
.I <assert.h>
was last included, the macro
.BR assert ()
-generates no code, and hence does nothing at all.
-Otherwise, the macro
+generates no code, and hence does nothing at all. It is not recommended to define
+.B NDEBUG
+if using
.BR assert ()
-prints an error message to standard error and terminates the program
-by calling
-.BR abort (3)
-if
-.I expression
-is false (i.e., compares equal to zero).
-.LP
-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.
+to detect error conditions since the software may behave non-deterministically.
.SH RETURN VALUE
No value is returned.
.SH ATTRIBUTES
--
2.5.5
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2016-06-02 9:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 9:07 Nikos Mavrogiannopoulos [this message]
[not found] ` <1464858451.5804.3.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-06-02 23:35 ` [PATCH] assert.3: improved description Michael Kerrisk (man-pages)
[not found] ` <dce9e3be-8461-2d09-197d-424a64eed8b7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-03 5:08 ` Nikos Mavrogiannopoulos
[not found] ` <1464930530.2843.0.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-06-03 11:41 ` Michael Kerrisk (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464858451.5804.3.camel@redhat.com \
--to=nmav-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox