为什么以下命令不会产生任何警告或错误,尽管
这种情况发生在Cygwin [gcc (GCC) 4.5.3]和Linux [gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)]上。
_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)]上。
#include <stdbool.h>
,也不存在bool
。 - Keith Thompson