【发布时间】:2013-03-06 04:05:52
【问题描述】:
// Filename: test.c
#include <sys/types.h>
int main() {
uint a;
return 0;
}
上面的代码可以使用 gcc 和 clang 编译,标准如 gnu89 或 gnu99。换句话说,以下工作。
$gcc test.c # for the default is std=gnu89
$clang test.c # for the default is std=gnu99
但是,以下失败并出现错误“未声明的 uint”。
$gcc -std=c99 test.c
$clang -std=c99 test.c
能否解释一下为什么 uint 的定义在 c99 标准中消失了?
【问题讨论】:
-
在这个头文件中写的比在“c99”的情况下 int 类型在 inttypes.h 中定义。