]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/assert_perror.3
getresuid.2, mremap.2, poll.2, remap_file_pages.2, setresuid.2, splice.2, sync_file_r...
[thirdparty/man-pages.git] / man3 / assert_perror.3
CommitLineData
fea681da
MK
1.\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
c13182ef 11.\"
fea681da
MK
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
23.\" This replaces an earlier man page written by Walter Harms
24.\" <walter.harms@informatik.uni-oldenburg.de>.
25.\"
26.TH ASSERT_PERROR 3 2002-08-25 "GNU" "Linux Programmer's Manual"
27.SH NAME
28assert_perror \- test errnum and abort
29.SH SYNOPSIS
30.nf
b80f966b 31.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
fea681da
MK
32.B #include <assert.h>
33.sp
34.BI "void assert_perror(int " errnum );
35.fi
36.SH DESCRIPTION
37If the macro
38.B NDEBUG
39was defined at the moment
bd12ab88 40.I <assert.h>
fea681da 41was last included, the macro
63aa9df0 42.BR assert_perror ()
fea681da
MK
43generates no code, and hence does nothing at all.
44Otherwise, the macro
63aa9df0 45.BR assert_perror ()
7bbdabc4 46prints an error message to standard error and terminates the program
fea681da 47by calling
fb186734 48.BR abort (3)
fea681da
MK
49if
50.I errnum
c7094399 51is nonzero.
c13182ef 52The message contains the filename, function name and
fea681da
MK
53line number of the macro call, and the output of
54.IR strerror(errnum) .
55.SH "RETURN VALUE"
56No value is returned.
57.SH "CONFORMING TO"
58This is a GNU extension.
59.SH BUGS
60The purpose of the assert macros is to help the programmer find bugs in
61his program, things that cannot happen unless there was a coding mistake.
62However, with system or library calls the situation is rather different,
63and error returns can happen, and will happen, and should be tested for.
2f0af33b
MK
64Not by an assert, where the test goes away when
65.B NDEBUG
66is defined,
c13182ef
MK
67but by proper error handling code.
68Never use this macro.
fea681da
MK
69.SH "SEE ALSO"
70.BR abort (3),
71.BR assert (3),
72.BR exit (3),
0a90178c
MK
73.BR strerror (3),
74.BR feature_test_macros (7)