-2
的情况下离奇结果我使用__int64
数据类型在64位AIX和我正在比较的情况下,奇异结果与064位整数中的比较
代码段:
__int64 indexExistingPart = GetValue(); // GetValue always returns -1.
if (indexExistingPart < 0)
{
DoSomething(); //control never comes to this part of the code
}
我也尝试将0赋值给另一个__int64
变量并用于比较。但是,这也不起作用:
__int64 indexExistingPart = GetValue(); // GetValue always returns -1.
__int64 temp =0;
if (indexExistingPart < temp)
{
DoSomething(); //control never comes to this part of the code
}
为什么比较运算符不适用于64位整数?有什么解决方法吗?
'__int64'不是标准的类型 - 它是如何定义,其中和?另外,GetValue()的返回类型是什么? – 2012-07-31 10:00:23
你确定__int64没有签名吗? – 2012-07-31 10:03:30
@Paul:GetValue()的返回类型很长。当我在AIX上使用__int64时,我没有收到任何编译错误。 – user1565291 2012-07-31 11:33:46