令我惊讶的是,我刚刚发现MS Visual Studio 2003向上缺少C99 stdint.h.我确定他们有他们的理由,但有谁知道我可以在哪里下载副本?如果没有这个头文件,我就没有uint32_t等有用类型的定义.
我在nuwen.net上使用minGW的mingw-w64(x64)分支.这是来自7.1版本的gcc:
gcc --version
gcc (GCC) 7.1.0
Run Code Online (Sandbox Code Playgroud)
我正在编译这个程序:
#include <stdio.h>
int main(void)
{
size_t a = 100;
printf("a=%lu\n",a);
printf("a=%llu\n",a);
printf("a=%zu\n",a);
printf("a=%I64u\n",a);
}
Run Code Online (Sandbox Code Playgroud)
有警告和c11标准:
gcc -Wall -Wextra -Wpedantic -std=c11 test_size_t.c
Run Code Online (Sandbox Code Playgroud)
我收到这些警告:
test_size_t.c: In function 'main':
test_size_t.c:6:14: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t {aka long long unsigned int}' [-Wformat=]
printf("a=%lu\n",a);
~~^
%I64u
test_size_t.c:6:14: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t {aka long long unsigned …Run Code Online (Sandbox Code Playgroud)