]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/assert_perror.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / assert_perror.3
CommitLineData
fea681da
MK
1.\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
4.\"
5.\" This replaces an earlier man page written by Walter Harms
6.\" <walter.harms@informatik.uni-oldenburg.de>.
7.\"
45186a5d 8.TH ASSERT_PERROR 3 2021-03-22 "Linux man-pages (unreleased)"
fea681da
MK
9.SH NAME
10assert_perror \- test errnum and abort
b813014f
AC
11.SH LIBRARY
12Standard C library
13.RI ( libc ", " \-lc )
fea681da
MK
14.SH SYNOPSIS
15.nf
b80f966b 16.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
fea681da 17.B #include <assert.h>
68e4db0a 18.PP
fea681da
MK
19.BI "void assert_perror(int " errnum );
20.fi
21.SH DESCRIPTION
22If the macro
23.B NDEBUG
24was defined at the moment
bd12ab88 25.I <assert.h>
fea681da 26was last included, the macro
63aa9df0 27.BR assert_perror ()
fea681da
MK
28generates no code, and hence does nothing at all.
29Otherwise, the macro
63aa9df0 30.BR assert_perror ()
7bbdabc4 31prints an error message to standard error and terminates the program
fea681da 32by calling
fb186734 33.BR abort (3)
fea681da
MK
34if
35.I errnum
c7094399 36is nonzero.
c13182ef 37The message contains the filename, function name and
fea681da
MK
38line number of the macro call, and the output of
39.IR strerror(errnum) .
47297adb 40.SH RETURN VALUE
fea681da 41No value is returned.
24d428e4
MS
42.SH ATTRIBUTES
43For an explanation of the terms used in this section, see
44.BR attributes (7).
c466875e
MK
45.ad l
46.nh
24d428e4
MS
47.TS
48allbox;
c466875e 49lbx lb lb
24d428e4
MS
50l l l.
51Interface Attribute Value
52T{
53.BR assert_perror ()
54T} Thread safety MT-Safe
55.TE
c466875e
MK
56.hy
57.ad
847e0d88 58.sp 1
3113c7f3 59.SH STANDARDS
fea681da
MK
60This is a GNU extension.
61.SH BUGS
886ea57d
MK
62The purpose of the assert macros is to help programmers find bugs in
63their programs, things that cannot happen unless there was a coding mistake.
fea681da
MK
64However, with system or library calls the situation is rather different,
65and error returns can happen, and will happen, and should be tested for.
2f0af33b
MK
66Not by an assert, where the test goes away when
67.B NDEBUG
68is defined,
c13182ef
MK
69but by proper error handling code.
70Never use this macro.
47297adb 71.SH SEE ALSO
fea681da
MK
72.BR abort (3),
73.BR assert (3),
74.BR exit (3),
0a4f8b7b 75.BR strerror (3)