ASSERT(3) — UNIX Programmer’s Manual
名称
assert − プログラムの検証
形式
#include <assert.h>
assert(expression)
解説
assert は、 そのプログラム内のその位置で、 expression (式)が真であるべきことを示すマクロです。 expression が偽(0)であると、 標準出力上への診断コメント付きで exit(2) を起動します。 cc(1) でコンパイルする場合、 −DNDEBUG オプションを用いると、 プログラム中から assert を実質上削除します。
診断
‘Assertion failed: file f line n.’ の中で、 f はソースファイルの名前で、 n は assert 文のある行番号です。
NEWS-OSRelease 3.3