'\" te .\" Copyright 1989 AT&T. Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. .TH assert 3C "30 Mar 2005" "SunOS 5.11" "Standard C Library Functions" .SH NAME assert \- verify program assertion .SH SYNOPSIS .LP .nf #include \fBvoid\fR \fBassert\fR(\fBint\fR \fIexpression\fR); .fi .SH DESCRIPTION .sp .LP The \fBassert()\fR macro inserts diagnostics into applications. When executed, if \fIexpression\fR is \fBFALSE\fR (zero), \fBassert()\fR prints the error message .sp .in +2 .nf Assertion failed: \fIexpression\fR, file \fIxyz\fR, line \fInnn\fR .fi .in -2 .sp .LP on the standard error output and aborts. In the error message, \fIxyz\fR is the name of the source file and \fInnn\fR the source line number of the \fBassert()\fR statement. These are respectively the values of the preprocessor macros \fB__FILE__\fR and \fB__LINE__\fR. .sp .LP Since \fBassert()\fR is implemented as a macro, the \fIexpression\fR may not contain any string literals. .sp .LP Compiling with the preprocessor option \fB\fR\fB-DNDEBUG\fR or with the preprocessor control statement \fB#define NDEBUG\fR ahead of the \fB#include\fR <\fBassert.h\fR> statement, will stop assertions from being compiled into the program. .sp .LP Messages printed from this function are in the native language specified by the \fBLC_MESSAGES\fR locale category. See \fBsetlocale\fR(3C). .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelSafe _ StandardSee \fBstandards\fR(5). .TE .SH SEE ALSO .sp .LP \fBabort\fR(3C), \fBgettext\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)