I have a code snippet(up.cpp) like this:
#include <stdio.h>
typedef unsigned long long Uint64;
int main()
{
    void *p = (void*)0xC0001234;
    Uint64 u64 = (Uint64)p;
    printf("{%llx}\n", u64);
    return 0;
}
Compiling it with 32-bit gcc 4.8.1, I get output:
{ffffffffc0001234}
Compiling it with 64-bit gcc 4.8.1, I get output:
{c0001234}
Yes, the 64-bit one gives the 32-bit value. The gcc 4.8.1 is from openSUSE 13.1 .
I also tried it on Visual C++ 2010 x86 & x64 complier(a bit code change, __int64 and %I64x), and surprising get the same results.
Of course, I intend to get {c0001234} on both x86 & x64. But why is there such difference?