2 .\" Copyright 1989 AT&T. Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
5 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH ASSERT 3C "Mar 30, 2005"
8 assert \- verify program assertion
14 \fBvoid\fR \fBassert\fR(\fBint\fR \fIexpression\fR);
20 The \fBassert()\fR macro inserts diagnostics into applications. When executed,
21 if \fIexpression\fR is \fBFALSE\fR (zero), \fBassert()\fR prints the error
26 Assertion failed: \fIexpression\fR, file \fIxyz\fR, line \fInnn\fR
32 on the standard error output and aborts. In the error message, \fIxyz\fR is the
33 name of the source file and \fInnn\fR the source line number of the
34 \fBassert()\fR statement. These are respectively the values of the preprocessor
35 macros \fB__FILE__\fR and \fB__LINE__\fR.
38 Since \fBassert()\fR is implemented as a macro, the \fIexpression\fR may not
39 contain any string literals.
42 Compiling with the preprocessor option \fB\fR\fB-DNDEBUG\fR or with the
43 preprocessor control statement \fB#define NDEBUG\fR ahead of the \fB#include\fR
44 <\fBassert.h\fR> statement, will stop assertions from being compiled into the
48 Messages printed from this function are in the native language specified by the
49 \fBLC_MESSAGES\fR locale category. See \fBsetlocale\fR(3C).
53 See \fBattributes\fR(5) for descriptions of the following attributes:
61 ATTRIBUTE TYPE ATTRIBUTE VALUE
63 Interface Stability Committed
67 Standard See \fBstandards\fR(5).
73 \fBabort\fR(3C), \fBgettext\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5),