「C言語/標準ライブラリ/stdbool.h」の版間の差分

削除された内容 追加された内容
Ef3 (トーク | 投稿記録)
cat.
タグ: 2017年版ソースエディター
Ef3 (トーク | 投稿記録)
Cite C17
タグ: 2017年版ソースエディター
 
1 行
{{Nav}}
 
= <!-- 7.31.9 Boolean type and values <stdbool.h> --> Boolean type and values <stdbool.h>:論理型と論理値 =
ヘッダーファイル <code><stdbool.h></code> には、4つのマクロが定義されています<ref name="jtc1-sc22-wg14-n2596-7.18418">{{cite book
| url = http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596c17_updated_proposed_fdis.pdf
| title = N2596 working draft — December 11, 2020 ISO/IEC 9899:202x (E)
| archiveurl = https://web.archive.org/web/20181230041359/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf
| page = 259, §7.18 ''Boolean type and values <stdbool.h>''
| archivedate = 2018-12-30
| publisher = [http://www.open-std.org/jtc1/sc22/wg14/www/projects ISO/IEC JTC1/SC22/WG14]}}</ref>。
| title = N2176 C17 ballot ISO/IEC 9899:2017
| page = 259210, §7.18 ''Boolean type and values <stdbool.h>''
| publisher = [http://www.open-std.org/jtc1/sc22/wg14/www/projects ISO/IEC JTC1/SC22/WG14]}}</ref>。
 
== マクロ ==
; bool
: キーワード _Bool に展開されます。
 
残りの3つのマクロは、#if 前処理ディレクティブでの使用に適しています。
; true
: 整数定数((_Bool)+1u)の1に展開されます。
; false
: 整数定数((_Bool)+0u)の0に展開されます。
; __bool_true_false_are_defined
: 整数の定数1に展開されます。
 
bool、true、falseというマクロを定義解除して、おそらく再定義する機能は、時代遅れの機能です<!--The ability to undefine and perhaps then redefine the macros bool, true, and false is an obsolescent feature.--><ref name="jtc1-sc22-wg14-n2596-7.31.119">{{cite book
| url = http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596c17_updated_proposed_fdis.pdf
| archiveurl = https://web.archive.org/web/20181230041359/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf
| title = N2596 working draft — December 11, 2020 ISO/IEC 9899:202x (E)
| archivedate = 2018-12-30
| page = 392, §7.31.11 ''Boolean type and values <stdbool.h>''
| title = N2176 C17 ballot ISO/IEC 9899:2017
| publisher = [http://www.open-std.org/jtc1/sc22/wg14/www/projects ISO/IEC JTC1/SC22/WG14]}}</ref>。
| page = 392332, §7.31.119 ''Boolean type and values <stdbool.h>''
| publisher = [http://www.open-std.org/jtc1/sc22/wg14/www/projects ISO/IEC JTC1/SC22/WG14]}}</ref>。
 
== 歴史 ==
ヘッダー <code><stdbool.h></code> は、ISO/IEC 9899:1999(通称:C99)で追加されました。
 
== 脚註 ==