问题在Windows%LLD [英] Problem with %lld on Windows

查看:106
本文介绍了问题在Windows%LLD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么这code:

 的#include<&stdio.h中GT;INT主(INT ARGC,字符** argv的){
    的printf(%LLD \\ n,4294967296LL);
}

这发出针对Windows:

  0

但是这为Linux:

  4294967296


解决方案

这是因为Visual Studio的C ++ 2003和更早版本不支持LLD%。但是,这code将工作:

 的#include<&stdio.h中GT;INT主(INT ARGC,字符** argv的){
    的printf(%I64d号\\ n,4294967296LL);
}

尺寸和距离规格(Visual Studio的C ++ 2003年)

尺寸和距离规格(Visual Studio的C ++ 2005)

Why does this code:

#include <stdio.h>

int main(int argc, char** argv) {
    printf("%lld\n", 4294967296LL);
}

emit this for Windows:

0

but this for Linux:

4294967296

解决方案

This is because Visual Studio C++ 2003 and earlier do not support %lld. But this code will work:

#include <stdio.h>

int main(int argc, char** argv) {
    printf("%I64d\n", 4294967296LL);
}

Size and Distance Specification (Visual Studio C++ 2003)

Size and Distance Specification (Visual Studio C++ 2005)

这篇关于问题在Windows%LLD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆