1ASSERT(3P)                 POSIX Programmer's Manual                ASSERT(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       assert — insert program diagnostics
13

SYNOPSIS

15       #include <assert.h>
16
17       void assert(scalar expression);
18

DESCRIPTION

20       The functionality described on this reference page is aligned with  the
21       ISO C  standard.  Any  conflict between the requirements described here
22       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
23       defers to the ISO C standard.
24
25       The  assert()  macro  shall  insert diagnostics into programs; it shall
26       expand to a void expression. When it is executed, if expression  (which
27       shall  have  a  scalar  type)  is false (that is, compares equal to 0),
28       assert() shall write information about the particular call that  failed
29       on stderr and shall call abort().
30
31       The  information  written  about the call that failed shall include the
32       text of the argument, the name of the source file, the source file line
33       number, and the name of the enclosing function; the latter are, respec‐
34       tively, the values of the preprocessing macros  __FILE__  and  __LINE__
35       and of the identifier __func__.
36
37       Forcing  a definition of the name NDEBUG, either from the compiler com‐
38       mand line or with the preprocessor  control  statement  #define  NDEBUG
39       ahead  of the #include <assert.h> statement, shall stop assertions from
40       being compiled into the program.
41

RETURN VALUE

43       The assert() macro shall not return a value.
44

ERRORS

46       No errors are defined.
47
48       The following sections are informative.
49

EXAMPLES

51       None.
52

APPLICATION USAGE

54       None.
55

RATIONALE

57       None.
58

FUTURE DIRECTIONS

60       None.
61

SEE ALSO

63       abort(), stdin
64
65       The Base Definitions volume of POSIX.1‐2017, <assert.h>
66
68       Portions of this text are reprinted and reproduced in  electronic  form
69       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
70       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
71       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
72       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
73       event of any discrepancy between this version and the original IEEE and
74       The Open Group Standard, the original IEEE and The Open Group  Standard
75       is  the  referee document. The original Standard can be obtained online
76       at http://www.opengroup.org/unix/online.html .
77
78       Any typographical or formatting errors that appear  in  this  page  are
79       most likely to have been introduced during the conversion of the source
80       files to man page format. To report such errors,  see  https://www.ker
81       nel.org/doc/man-pages/reporting_bugs.html .
82
83
84
85IEEE/The Open Group                  2017                           ASSERT(3P)
Impressum