From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZUyO-0005RP-8k for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:51:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZUyJ-0005Iq-3k for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:51:43 -0500 Received: from [199.232.76.173] (port=46002 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZUyI-0005If-W0 for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:51:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39189) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZUyI-0003Hr-DU for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:51:38 -0500 Date: Mon, 25 Jan 2010 19:51:32 +0000 From: "Daniel P. Berrange" Subject: Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld Message-ID: <20100125195132.GE5138@redhat.com> References: <1264368221-3040-1-git-send-email-hpoussin@reactos.org> <20100125100905.GA9019@redhat.com> <4B5DD596.4040503@mail.berlios.de> <20100125174756.GB11998@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100125174756.GB11998@redhat.com> Reply-To: "Daniel P. Berrange" List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Herve Poussineau , qemu-devel@nongnu.org, lcapitulino@redhat.com On Mon, Jan 25, 2010 at 07:47:56PM +0200, Michael S. Tsirkin wrote: > On Mon, Jan 25, 2010 at 06:32:06PM +0100, Stefan Weil wrote: > > Michael S. Tsirkin schrieb: > > > On Sun, Jan 24, 2010 at 09:23:41PM +0000, Herve Poussineau wrote: > > >> Replace %lld occurrences by PRId64. > > > > > > This is wrong. > > > long long values should be printed with %lld. > > > size_t - with %zd. PRId64 is for int64_t. > > > > > > > size_t => %zu, ssize_t => %zd might be better. > > > > And none of them works on win32, so using them > > there can result in a crash: > > > > size_t st = 4711; > > fprintf(stderr, "st=%zu, %s\n", st, "test"); > > > > printf functions on win32 don't know %z. > > They run > > > > fprintf(stderr, "st=zu, %s\n", st, "test"); > > > > which results in an memory access fault when printf > > wants to read the memory at address 0x4711. > > > > Regards, > > Stefan Weil > > Let's just implement a compliant printf? It is a shame that QEMU isn't using GNULIB, since that comes with a nice portable replacement printf() implementation that is transparently used on any broken platform. Beyond just Win32, a great many UNIX have broken printf() in one form or another too: http://www.gnu.org/software/hello/manual/gnulib/printf.html I don't know how easy it would be to extract the gnulib printf() impl on its own and use that in QEMU without the entire gnulib infrastructure Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|