// 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
但是,以下操作失败并出现错误“undeclared uint”。
$gcc -std=c99 test.c
$clang -std=c99 test.c
有人可以解释为什么 uint 的定义在 c99 标准中消失了吗?
最佳答案
因为 C 标准没有定义/要求 uint
类型。它很可能是特定于编译器、系统或库的便利类型。不要使用它。
关于c - 为什么 <sys/types.h> 中的 uint 使用 -std=c99 消失了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15466342/