[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld
From: |
Stefan Weil |
Subject: |
Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld |
Date: |
Mon, 25 Jan 2010 20:23:22 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090707) |
Michael S. Tsirkin schrieb:
> 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?
Or format the harddisk and install linux?
Maybe that would be the better option :-)
Of course you can add a printf to qemu, or to mingw32.
No need to implement it - there are lots of good free
implementations.
The mingw developers are aware of the problem
(http://www.mail-archive.com/address@hidden/msg00416.html).
If there is an easy solution, they will fix the problem.
I don't think the problem can be fixed easy:
there is not only printf but a lot of functions which use
format strings. They are implemented in msvcrt.dll.
Replacing single functions in a dll is difficult.
Telling code which printf in which dll is the correct
one is difficult, too.
There are easy solutions for QEMU: type cast
size_t values to unsigned or uint32_t in printf
or use a new macro (for example PRIsize) in
format strings. That macro would be different for
mingw32 and standard conforming systems.
- Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, (continued)
- Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Daniel P. Berrange, 2010/01/26
- Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Anthony Liguori, 2010/01/26
- Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Avi Kivity, 2010/01/26
- Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Anthony Liguori, 2010/01/26
- Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Avi Kivity, 2010/01/26
- Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Anthony Liguori, 2010/01/26
Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Stefan Weil, 2010/01/25
Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Daniel P. Berrange, 2010/01/25
Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld, Stefan Weil, 2010/01/25
Re: [Qemu-devel] [PATCH] win32: use PRId64 instead of %lld, Anthony Liguori, 2010/01/26