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

CONFORMING TO

27       This is a GNU extension.
28

BUGS

30       The purpose of the assert macros is to help the programmer find bugs in
31       his program, things that cannot happen unless there was a  coding  mis‐
32       take.   However,  with  system or library calls the situation is rather
33       different, and error returns can happen, and will happen, and should be
34       tested  for.  Not by an assert, where the test goes away when NDEBUG is
35       defined, but by proper error handling code.  Never use this macro.
36

SEE ALSO

38       abort(3), assert(3), exit(3), strerror(3)
39

COLOPHON

41       This page is part of release 3.53 of the Linux  man-pages  project.   A
42       description  of  the project, and information about reporting bugs, can
43       be found at http://www.kernel.org/doc/man-pages/.
44
45
46
47GNU                               2002-08-25                  ASSERT_PERROR(3)
Impressum