RES: [Dev-C++] Can I handle 64 bits with unsigned long long int ?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel K. O. <dan...@ya...> - 2003-04-06 18:35:34
|
> Obviously MINGW's unsigned long long isn't 64 bit or there is serious
> compiler bug. An equivalent code:
Ok, let's try again... You have:
unsigned long long i = ULLONG_MAX;
So you have i = 0xFFFFFFFFFFFFFFFF;
And sizeof (i) = 8;
Now, you printf("%llu", i); printf provided on MSVCRT.DLL should "eat" 8
bytes from the stack (0xFFFFFFFFFFFFFFFF), to print the unsigned long long.
But it doesn't. I thinks that %llu is for a 4 bytes int, and only prints the
first word of the unsigned long long (you can put another "%llu", if you
want to see the other half :P ). This bug is not on MinGW, but on
MSVCRT.DLL, where the printf is implemented. While MinGW keeps using the
runtime lib from MS, or MS doesn't update its C Runtime library, you'll have
to use "%I64d", "%I64u", "%I64x", etc.
Again, here is the link about this issue:
"printf function does not support long long"
[all-in-one-line]
http://sf.net/tracker/?func=detail&aid=661165&group_id=2435&atid=102435
[/all-in-one-line]
Daniel K. O.
|