So unsigned long long
is the same as uint64_t
in the 32-bit compilation but not in 64-bit compilation?
Yes.
In 32-bit mode, most likely long
is 32 bits and long long
is 64 bits. In 64-bit mode, both are probably 64 bits.
In 32-bit mode, the compiler (more precisely the <stdint.h>
header) defines uint64_t
as unsigned long long
, because unsigned long
isn't wide enough.
In 64-bit mode, it defines uint64_t
as unsigned long
.
It could have defined it as unsigned long long
in both modes. The choice is arbitrary; all that's required is that it has to be a 64-bit type.
In general, each of the integer types defined in <stdint.h>
is a typedef for some predefined type with the appropriate characteristics. You can't assume that any of them are distinct from the predefined types.