我为什么不能初始化一个很长很长的预期?

问题描述 投票:1回答:1

我的VC2017编译器显示这种行为,可以有人给我解释一下这是怎么回事?:

long long testLLSigned0 = LLONG_MIN; // OK, equal to -922129006921510580
long long testLLSigned1 = -922129006921510580i64‬; // Error, invalid suffix i64 on integer constant
long long testLLSigned2 = -922337203685477580i64; // OK!
long long testLLSigned3 = -922337203685477580LL; // OK!
long long testLLSigned4 = -‭62129006921510911‬LL; // Error, use of undeclared identifier ‭62129006921510911‬LL
long long testLLSigned5 = -‭62129006921510911i64‬; // Error, use of undeclared identifier ‭62129006921510911i64
c++ 64bit long-long
1个回答
1
投票

由于EljayNathanOlivereerorikauser1810087,我解决了这个问题。

该代码没有编译最大的原因是由于复制从Windows计算器(!)到任何现代编辑器的计算值(!)。值62129006921510911被复制与无形的Unicode字符编辑器里面!在VIM粘贴后的结果表明我们:-<202d>62129006921510911<202c>LL

附注:使用LL语法中,I64语法是特定于Microsoft,不便于携带。

© www.soinside.com 2019 - 2024. All rights reserved.