1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Modified Sat Jul 24 21:42:42 1993 by Rik Faith <faith@cs.unc.edu>
24 .\" Modified Tue Oct 22 23:44:11 1996 by Eric S. Raymond <esr@thyrsus.com>
26 .\" Japanese Version Copyright (c) 1996 Kentaro OGAWA
27 .\" all rights reserved.
28 .\" Translated Sun, 14 Jul 1996 01:33:26 +0900
29 .\" by Kentaro OGAWA <k_ogawa@oyna.cc.muroran-it.ac.jp>
30 .\" Updated Fri 6 Oct JST 2000 by Kentaro Shirakata <argrath@ub32.org>
31 .\" Updated Thu 19 Sep JST 2002 by Kentaro Shirakata <argrath@ub32.org>
33 .TH ASSERT 3 2002-08-25 "GNU" "Linux Programmer's Manual"
35 assert \- 診断が偽の時にプログラムを中止する
38 .B #include <assert.h>
40 .BI "void assert(scalar " expression );
45 .\"O was defined at the moment
47 .\"O was last included, the macro
49 .\"O generates no code, and hence does nothing at all.
55 マクロは何のコードも生成せず、従って全く何もしない。
56 .\"O Otherwise, the macro
58 .\"O prints an error message to standard error and terminates the program
63 .\"O is false (i.e., compares equal to zero).
68 が偽の時(すなわち、比較の結果が0と等しい時)に
69 標準エラー出力にエラーメッセージを表示し、さらに
71 を呼び出すことによって、プログラムを終了させる。
73 .\"O The purpose of this macro is to help the programmer find bugs in
75 .\"O The message "assertion failed in file foo.c, function
76 .\"O do_bar(), line 1287" is of no help at all to a user.
77 このマクロの目的は、プログラマーがプログラムのバグを発見する手助けを
78 することである。"assertion failed in file foo.c, function do_bar(), line 1287"
79 というメッセージはユーザーには何の助けにもならない。
83 .\"O POSIX.1-2001, C89, C99.
86 .\"O is required to be of type
88 .\"O and undefined behavior results if it is not, but in C99
89 .\"O it may have any scalar type.
90 POSIX.1-2001, C89, C99.
95 型であることが必要とされ、そうでない場合の動作は未定義とされていた。
96 しかし C99 ではどのようなスカラ値でもよいことになった。
97 .\"O .\" See Defect Report 107 for more details.
98 .\" 詳細は不具合報告 107 を参照のこと。
101 .\"O is implemented as a macro; if the expression tested has side-effects,
102 .\"O program behavior will be different depending on whether
105 .\"O This may create Heisenbugs which go away when debugging
108 は、マクロとして実装されている。すなわち、
109 試されている式が副作用を持っている場合には、
112 が定義されているかどうかに依存して、プログラムの振舞いは異なるだろう。
113 これによって、バグ出しするときには消えてしまう
114 ハイゼンバグ(Heisenbugs)を生み出すだろう。
117 .BR assert_perror (3),