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
4

1 回答 1

0

感谢EljayNathanOlivereerorikauser1810087,我解决了它。

代码未编译的最大原因是将计算值从 Windows 计算器 (!) 复制到任何现代编辑器 (!) 中。值 62129006921510911 被复制到编辑器中,带有不可见的unicode 字符!粘贴在 vim 中的结果向我们展示了:-<202d>62129006921510911<202c>LL

旁注:使用 LL 语法,i64 语法是 Microsoft 特有的,不可移植。

于 2019-02-04T15:17:38.743 回答