OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / assert.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
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.
6 .\"
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.
11 .\"
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
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" License.
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>
25 .\"
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>
32 .\"
33 .TH ASSERT 3  2002-08-25 "GNU" "Linux Programmer's Manual"
34 .SH Ì¾Á°
35 assert \- ¿ÇÃǤ¬µ¶¤Î»þ¤Ë¥×¥í¥°¥é¥à¤òÃæ»ß¤¹¤ë
36 .SH ½ñ¼°
37 .nf
38 .B #include <assert.h>
39 .sp
40 .BI "void assert(scalar " expression );
41 .fi
42 .SH ÀâÌÀ
43 .\"O If the macro
44 .\"O .B NDEBUG
45 .\"O was defined at the moment
46 .\"O .I <assert.h>
47 .\"O was last included, the macro
48 .\"O .BR assert ()
49 .\"O generates no code, and hence does nothing at all.
50 .I <assert.h>
51 ¤¬ºÇ¸å¤Ë¥¤¥ó¥¯¥ë¡¼¥É¤µ¤ì¤¿»þÅÀ¤Ç¡¢
52 .B NDEBUG
53 ¥Þ¥¯¥í¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¡¢
54 .BR assert ()
55 ¥Þ¥¯¥í¤Ï²¿¤Î¥³¡¼¥É¤âÀ¸À®¤»¤º¡¢½¾¤Ã¤ÆÁ´¤¯²¿¤â¤·¤Ê¤¤¡£
56 .\"O Otherwise, the macro
57 .\"O .BR assert ()
58 .\"O prints an error message to standard error and terminates the program
59 .\"O by calling
60 .\"O .BR abort (3)
61 .\"O if
62 .\"O .I expression
63 .\"O is false (i.e., compares equal to zero).
64 ¤µ¤â¤Ê¤±¤ì¤Ð¡¢
65 .BR assert (3)
66 ¥Þ¥¯¥í¤Ï
67 .I expression
68 ¤¬µ¶¤Î»þ(¤¹¤Ê¤ï¤Á¡¢Èæ³Ó¤Î·ë²Ì¤¬0¤ÈÅù¤·¤¤»þ)¤Ë
69 ɸ½à¥¨¥é¡¼½ÐÎϤ˥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤·¡¢¤µ¤é¤Ë
70 .BR abort ()
71 ¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ë¤è¤Ã¤Æ¡¢¥×¥í¥°¥é¥à¤ò½ªÎ»¤µ¤»¤ë¡£
72 .LP
73 .\"O The purpose of this macro is to help the programmer find bugs in
74 .\"O his program.
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 ¤È¤¤¤¦¥á¥Ã¥»¡¼¥¸¤Ï¥æ¡¼¥¶¡¼¤Ë¤Ï²¿¤Î½õ¤±¤Ë¤â¤Ê¤é¤Ê¤¤¡£
80 .SH ÊÖ¤êÃÍ
81 ÃͤÏÊÖ¤µ¤ì¤Ê¤¤¡£
82 .SH ½àµò
83 .\"O POSIX.1-2001, C89, C99.
84 .\"O In C89,
85 .\"O .B expression
86 .\"O is required to be of type
87 .\"O .I int
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.
91 C89 ¤Ç¤Ï
92 .B expression
93 ¤Ï
94 .I int
95 ·¿¤Ç¤¢¤ë¤³¤È¤¬É¬ÍפȤµ¤ì¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤ÎÆ°ºî¤Ï̤ÄêµÁ¤È¤µ¤ì¤Æ¤¤¤¿¡£
96 ¤·¤«¤· C99 ¤Ç¤Ï¤É¤Î¤è¤¦¤Ê¥¹¥«¥éÃͤǤâ¤è¤¤¤³¤È¤Ë¤Ê¤Ã¤¿¡£
97 .\"O .\" See Defect Report 107 for more details.
98 .\" ¾ÜºÙ¤ÏÉÔ¶ñ¹çÊó¹ð 107 ¤ò»²¾È¤Î¤³¤È¡£
99 .SH ¥Ð¥°
100 .\"O .BR assert ()
101 .\"O is implemented as a macro; if the expression tested has side-effects,
102 .\"O program behavior will be different depending on whether
103 .\"O .B NDEBUG
104 .\"O is defined.
105 .\"O This may create Heisenbugs which go away when debugging
106 .\"O is turned on.
107 .BR assert ()
108 ¤Ï¡¢¥Þ¥¯¥í¤È¤·¤Æ¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¡£¤¹¤Ê¤ï¤Á¡¢
109 »î¤µ¤ì¤Æ¤¤¤ë¼°¤¬ÉûºîÍѤò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢
110 ¥Þ¥¯¥í
111 .B NDEBUG
112 ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤Ë°Í¸¤·¤Æ¡¢¥×¥í¥°¥é¥à¤Î¿¶Éñ¤¤¤Ï°Û¤Ê¤ë¤À¤í¤¦¡£
113 ¤³¤ì¤Ë¤è¤Ã¤Æ¡¢¥Ð¥°½Ð¤·¤¹¤ë¤È¤­¤Ë¤Ï¾Ã¤¨¤Æ¤·¤Þ¤¦
114 ¥Ï¥¤¥¼¥ó¥Ð¥°(Heisenbugs)¤òÀ¸¤ß½Ð¤¹¤À¤í¤¦¡£
115 .SH ´ØÏ¢¹àÌÜ
116 .BR abort (3),
117 .BR assert_perror (3),
118 .BR exit (3)