71 lines
1.4 KiB
Plaintext
71 lines
1.4 KiB
Plaintext
.\" @(#)assert.3v 1.1 94/10/31 SMI; from UCB 4.2
|
|
.TH ASSERT 3V "6 October 1989"
|
|
.SH NAME
|
|
assert \- program verification
|
|
.SH SYNOPSIS
|
|
.B #include <assert.h>
|
|
.LP
|
|
.B assert(expression)
|
|
.IX "assert()" "" "\fLassert()\fP \(em program verification"
|
|
.IX "program verification" "" "program verification \(em \fLassert()\fP"
|
|
.IX "debugging support" "" "debugging support \(em \fLassert()\fP"
|
|
.SH DESCRIPTION
|
|
.LP
|
|
.B assert(\|)
|
|
is a macro that indicates
|
|
.I expression
|
|
is expected to be true at this point in the program.
|
|
If
|
|
.I expression
|
|
is false (0),
|
|
it displays a diagnostic message on the standard output and exits (see
|
|
.BR exit (2V)).
|
|
Compiling with the
|
|
.BR cc (1V)
|
|
option
|
|
\fB\s-1\-DNDEBUG\s0\fP,
|
|
or placing the preprocessor control statement
|
|
.IP
|
|
.B #define NDEBUG
|
|
.LP
|
|
before the
|
|
.RB `` "#include <assert.h>" ''
|
|
statement effectively deletes
|
|
.B assert(\|)
|
|
from the program.
|
|
.SH SYSTEM V DESCRIPTION
|
|
.LP
|
|
The System V version of
|
|
.B assert(\|)
|
|
calls
|
|
.BR abort (3)
|
|
rather than
|
|
.BR exit(\|) .
|
|
.LP
|
|
.SH SEE ALSO
|
|
.BR cc (1V),
|
|
.BR exit (2V),
|
|
.BR abort (3)
|
|
.SH DIAGNOSTICS
|
|
.TP
|
|
.BI "Assertion failed: file " f " line " n
|
|
The expression passed to the
|
|
.B assert(\|)
|
|
statement at line
|
|
.I n
|
|
of source file
|
|
.I f
|
|
was false.
|
|
.SH SYSTEM V DIAGNOSTICS
|
|
.TP
|
|
.BI "Assertion failed: " expression ", file" " f" ", line " n
|
|
The
|
|
.I expression
|
|
passed to the
|
|
.B assert(\|)
|
|
statement at line
|
|
.I n
|
|
of source file
|
|
.I f
|
|
was false.
|