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