1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" This replaces an earlier man page written by Walter Harms
24 .\" <walter.harms@informatik.uni-oldenburg.de>.
26 .TH ASSERT_PERROR 3 2002-08-25 "GNU" "Linux Programmer's Manual"
28 assert_perror \- test errnum and abort
31 .B #define _GNU_SOURCE
32 .B #include <assert.h>
34 .BI "void assert_perror(int " errnum );
39 was defined at the moment
41 was last included, the macro
43 generates no code, and hence does nothing at all.
46 prints an error message to standard error and terminates the program
52 The message contains the filename, function name and
53 line number of the macro call, and the output of
54 .IR strerror(errnum) .
58 This is a GNU extension.
60 The purpose of the assert macros is to help the programmer find bugs in
61 his program, things that cannot happen unless there was a coding mistake.
62 However, with system or library calls the situation is rather different,
63 and error returns can happen, and will happen, and should be tested for.
64 Not by an assert, where the test goes away when
67 but by proper error handling code.
74 .BR feature_test_macros (7)