I am using __int64 datatype on 64 bit AIX and I am getting bizarre results in the case of comparison with 0.
Code snippet :
__int64 indexExistingPart = GetValue(); // GetValue always returns -1.
if (indexExistingPart < 0 )
{
DoSomething(); //control never comes to this part of the code
}
I have also tried assigning 0 to another __int64 variable and used in in the comparison. However, this also did not work:
__int64 indexExistingPart = GetValue(); // GetValue always returns -1.
__int64 temp =0;
if (indexExistingPart < temp )
{
DoSomething(); //control never comes to this part of the code
}
Why comparison operator is not working for 64 bit integers? Is there any workaround?
The symptoms are consistent with
__int64being a typedef forunsigned longin your project. (__int64is not a type provided by AIX, at least according to the IBM docs.) Try this instead: