61 lines
972 B
Groff
61 lines
972 B
Groff
.TH ASSERT 3 "$Revision$"
|
|
.ad
|
|
.SH NAME
|
|
assert \- program verification
|
|
.SH SYNOPSIS
|
|
.B #include <assert.h>
|
|
.PP
|
|
.B assert(expression)
|
|
.PP
|
|
.B _BadAssertion(fn, lino, ass)
|
|
.br
|
|
char *fn, *ass;
|
|
.br
|
|
unsigned int lino;
|
|
.SH DESCRIPTION
|
|
.PP
|
|
.I Assert
|
|
is a macro that indicates
|
|
.I expression
|
|
is expected to be true at this point in the program.
|
|
It causes a call to
|
|
.I _BadAssertion
|
|
when
|
|
.I expression
|
|
is false (0).
|
|
.PP
|
|
The routine
|
|
.I_BadAssertion
|
|
accepts three parameters:
|
|
a filename, a linenumber,
|
|
and a string representing a failed assertion.
|
|
It causes a
|
|
.IR sys_stop (S_ABORT)
|
|
with a diagnostic comment on standard error.
|
|
.PP
|
|
The assertions are disabled by defining the preprocessor constant NDEBUG.
|
|
.SH DIAGNOSTICS
|
|
.IR fn ,
|
|
line
|
|
.IR lino :
|
|
assertion
|
|
.I ass
|
|
failed.
|
|
.br
|
|
.I fn
|
|
is the source file,
|
|
.I lino
|
|
is the source line number,
|
|
and
|
|
.I ass
|
|
is the assertion
|
|
of the
|
|
.I assert
|
|
statement.
|
|
.SH MODULES
|
|
system(3)
|
|
.SH FILES
|
|
.nf
|
|
~em/modules/h/assert.h
|
|
~em/modules/lib/libassert.a
|
|
.fi
|