Windows 上的 %lld 问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/664015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:10:27 来源:igfitidea点击:
Problem with %lld on Windows
提问by Jared Oberhaus
Why does this code:
为什么这段代码:
#include <stdio.h>
int main(int argc, char** argv) {
printf("%lld\n", 4294967296LL);
}
emit this for Windows:
为 Windows 发出这个:
0
but this for Linux:
但这适用于 Linux:
4294967296
回答by Jared Oberhaus
This is because Visual Studio C++ 2003 and earlier do not support %lld. But this code will work:
这是因为 Visual Studio C++ 2003 及更早版本不支持 %lld。但是这段代码会起作用:
#include <stdio.h>
int main(int argc, char** argv) {
printf("%I64d\n", 4294967296LL);
}
Size and Distance Specification (Visual Studio C++ 2003)
大小和距离规范 (Visual Studio C++ 2003)