1ASSERT_PERROR(3)           Linux Programmer's Manual          ASSERT_PERROR(3)
2
3
4

NAME

6       assert_perror - test errnum and abort
7

SYNOPSIS

9       #define _GNU_SOURCE         /* See feature_test_macros(7) */
10       #include <assert.h>
11
12       void assert_perror(int errnum);
13

DESCRIPTION

15       If  the  macro  NDEBUG  was  defined  at the moment <assert.h> was last
16       included, the macro assert_perror() generates no code, and  hence  does
17       nothing  at  all.  Otherwise, the macro assert_perror() prints an error
18       message to  standard  error  and  terminates  the  program  by  calling
19       abort(3)  if  errnum  is  nonzero.   The message contains the filename,
20       function name and line number of the macro call, and the output of str‐
21       error(errnum).
22

RETURN VALUE

24       No value is returned.
25

ATTRIBUTES

27       For   an   explanation   of   the  terms  used  in  this  section,  see
28       attributes(7).
29
30       ┌────────────────┬───────────────┬─────────┐
31Interface       Attribute     Value   
32       ├────────────────┼───────────────┼─────────┤
33assert_perror() │ Thread safety │ MT-Safe │
34       └────────────────┴───────────────┴─────────┘
35

CONFORMING TO

37       This is a GNU extension.
38

BUGS

40       The purpose of the assert macros is to help programmers  find  bugs  in
41       their  programs,  things  that  cannot happen unless there was a coding
42       mistake.  However, with system or library calls the situation is rather
43       different, and error returns can happen, and will happen, and should be
44       tested for.  Not by an assert, where the test goes away when NDEBUG  is
45       defined, but by proper error handling code.  Never use this macro.
46

SEE ALSO

48       abort(3), assert(3), exit(3), strerror(3)
49

COLOPHON

51       This  page  is  part of release 4.16 of the Linux man-pages project.  A
52       description of the project, information about reporting bugs,  and  the
53       latest     version     of     this    page,    can    be    found    at
54       https://www.kernel.org/doc/man-pages/.
55
56
57
58GNU                               2017-09-15                  ASSERT_PERROR(3)
Impressum