1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified Sat Jul 24 21:42:42 1993 by Rik Faith <faith@cs.unc.edu>
26 .\" Modified Tue Oct 22 23:44:11 1996 by Eric S. Raymond <esr@thyrsus.com>
27 .TH ASSERT 3 2013-09-26 "GNU" "Linux Programmer's Manual"
29 assert \- abort the program if assertion is false
32 .B #include <assert.h>
34 .BI "void assert(scalar " expression );
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
51 is false (i.e., compares equal to zero).
53 The purpose of this macro is to help programmers find bugs in
55 The message "assertion failed in file foo.c, function
56 do_bar(), line 1287" is of no help at all to a user.
60 POSIX.1-2001, C89, C99.
63 is required to be of type
65 and undefined behavior results if it is not, but in C99
66 it may have any scalar type.
67 .\" See Defect Report 107 for more details.
70 is implemented as a macro; if the expression tested has side-effects,
71 program behavior will be different depending on whether
74 This may create Heisenbugs which go away when debugging
78 .BR assert_perror (3),