【发布时间】:2013-05-08 15:48:13
【问题描述】:
为什么即使_Bool 不是 C89 的一部分,以下命令也不会产生警告或错误?
$ echo "_Bool x;" | gcc -x c -c -std=c89 -pedantic -Wall -Wextra -
为了比较,将_Bool 更改为bool 会导致错误:
$ echo "bool x;" | gcc -x c -c -std=c89 -pedantic -Wall -Wextra -
<stdin>:1:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘x’
这发生在 Cygwin [gcc (GCC) 4.5.3] 和 Linux [gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)] 上。
【问题讨论】:
-
即使在 C99 中,如果没有
#include <stdbool.h>,bool也不存在