From: Jamie Lokier <jamie@shareable.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Mingw GCC not recognising printf format "%I64u"
Date: Thu, 29 Jan 2009 18:42:34 +0000 [thread overview]
Message-ID: <20090129184234.GA13169@shareable.org> (raw)
In-Reply-To: <4981C49E.5070207@codemonkey.ws>
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
next prev parent reply other threads:[~2009-01-29 18:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 19:43 [Qemu-devel] [PATCH] Silence half of warnings in MinGW Consul
2009-01-28 21:50 ` Anthony Liguori
2009-01-29 6:21 ` [Qemu-devel] Mingw GCC not recognising printf format "%I64u" Jamie Lokier
2009-01-29 6:28 ` Jamie Lokier
2009-01-29 7:42 ` François Revol
2009-01-29 13:36 ` Anthony Liguori
2009-01-29 13:55 ` Jamie Lokier
2009-01-29 15:00 ` Anthony Liguori
2009-01-29 18:34 ` [Qemu-devel] " Consul
2009-01-29 18:42 ` Jamie Lokier [this message]
2009-01-29 19:50 ` [Qemu-devel] " Anthony Liguori
2009-01-29 20:44 ` [Qemu-devel] " Consul
2009-01-29 20:56 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090129184234.GA13169@shareable.org \
--to=jamie@shareable.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).