1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" This replaces an earlier man page written by Walter Harms
26 .\" <walter.harms@informatik.uni-oldenburg.de>.
28 .TH ASSERT_PERROR 3 2017-09-15 "GNU" "Linux Programmer's Manual"
30 assert_perror \- test errnum and abort
33 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
34 .B #include <assert.h>
36 .BI "void assert_perror(int " errnum );
41 was defined at the moment
43 was last included, the macro
45 generates no code, and hence does nothing at all.
48 prints an error message to standard error and terminates the program
54 The message contains the filename, function name and
55 line number of the macro call, and the output of
56 .IR strerror(errnum) .
60 For an explanation of the terms used in this section, see
66 Interface Attribute Value
69 T} Thread safety MT-Safe
73 This is a GNU extension.
75 The purpose of the assert macros is to help programmers find bugs in
76 their programs, things that cannot happen unless there was a coding mistake.
77 However, with system or library calls the situation is rather different,
78 and error returns can happen, and will happen, and should be tested for.
79 Not by an assert, where the test goes away when
82 but by proper error handling code.