Subj : __int64 problem To : borland.public.cpp.borlandcpp From : Joergen Ibsen Date : Sun Oct 17 2004 03:27 pm Is there a problem with applying a unary operator to the result of an arithmetic operation on two unsigned __int64 values? As an example, the code: printf("-1 %016I64X\n", -( (unsigned __int64)1 )); printf("-(1+1) %016I64X\n", -( (unsigned __int64)1 + (unsigned __int64)1 )); printf("~1 %016I64X\n", ~( (unsigned __int64)1 )); printf("~(1+1) %016I64X\n", ~( (unsigned __int64)1 + (unsigned __int64)1 )); produces: -1 FFFFFFFFFFFFFFFF -(1+1) 00000000FFFFFFFE ~1 FFFFFFFFFFFFFFFE ~(1+1) 00000000FFFFFFFD on both the free Borland C++ 5.5.1 and Borland C++ Builder 6. Visual C++, Pelles C, MinGW (GCC) and Digital Mars C all produce: -1 FFFFFFFFFFFFFFFF -(1+1) FFFFFFFFFFFFFFFE ~1 FFFFFFFFFFFFFFFE ~(1+1) FFFFFFFFFFFFFFFD .