[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u"
From: |
Jamie Lokier |
Subject: |
Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u" |
Date: |
Thu, 29 Jan 2009 18:42:34 +0000 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Anthony Liguori wrote:
> >>#ifdef _WIN32
> >>#define PRIu64 "%llu"
> >>#endif
> >>
> >Qemu does that already!
>
> I don't think so. mingw32 actuallt defines PRIu64 as "%I64u" even
> though GCC doesn't like it.
Look again. qemu/qemu-common.h:
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define WINVER 0x0501 /* needed for ipv6 bits */
#include <windows.h>
...etc...
#define PRId64 "I64d"
#define PRIx64 "I64x"
#define PRIu64 "I64u"
#define PRIo64 "I64o"
#endif
The only condition is whether _WIN32 is defined, which means WIN32
API, except that it's also defined with Cygwin (and other unix
emulations) which have quite different functions.
> FWIW, the following seems to work for me:
>
> /* Mingw has a broken PRIu64 */
> #if defined(__MINGW32__)
> #undef PRIu64
> #define PRIu64 "Ld"
> #endif
(Should by "Lu", btw).
How you checked it prints correctly? There are Googlable reports of
people using "%lld" on Mingw saying that it doesn't print large 64-bit
values correctly, because it truncates them to 32 bits, and trying
"%I64u" and it works. Possibly due to Mingw programs calling
Microsoft's C library, therefore being subject to Windowsness.
The same _could_ happen with "%Ld" or "%Lu", if Microsoft hasn't
implemented that as 64-bit.
-- Jamie
- [Qemu-devel] [PATCH] Silence half of warnings in MinGW, Consul, 2009/01/28
- Re: [Qemu-devel] [PATCH] Silence half of warnings in MinGW, Anthony Liguori, 2009/01/28
- [Qemu-devel] Mingw GCC not recognising printf format "%I64u", Jamie Lokier, 2009/01/29
- Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u", Jamie Lokier, 2009/01/29
- Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u", François Revol, 2009/01/29
- Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u", Anthony Liguori, 2009/01/29
- Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u", Jamie Lokier, 2009/01/29
- Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u", Anthony Liguori, 2009/01/29
- [Qemu-devel] Re: Mingw GCC not recognising printf format "%I64u", Consul, 2009/01/29
- Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u",
Jamie Lokier <=
- Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u", Anthony Liguori, 2009/01/29
- [Qemu-devel] Re: Mingw GCC not recognising printf format "%I64u", Consul, 2009/01/29
- Re: [Qemu-devel] Re: Mingw GCC not recognising printf format "%I64u", Anthony Liguori, 2009/01/29