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
19

DESCRIPTION

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

RETURN VALUE

39       The assert() macro shall not return a value.
40

ERRORS

42       No errors are defined.
43
44       The following sections are informative.
45

EXAMPLES

47       None.
48

APPLICATION USAGE

50       None.
51

RATIONALE

53       None.
54

FUTURE DIRECTIONS

56       None.
57

SEE ALSO

59       abort(),  stderr,  the Base Definitions volume of IEEE Std 1003.1-2001,
60       <assert.h>
61
63       Portions of this text are reprinted and reproduced in  electronic  form
64       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
65       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
66       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
67       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
68       event of any discrepancy between this version and the original IEEE and
69       The Open Group Standard, the original IEEE and The Open Group  Standard
70       is  the  referee document. The original Standard can be obtained online
71       at http://www.opengroup.org/unix/online.html .
72
73
74
75IEEE/The Open Group                  2003                           ASSERT(3P)
Impressum