bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests/test-vasprintf.c: Test %08lx.


From: Simon Josefsson
Subject: Re: [PATCH] tests/test-vasprintf.c: Test %08lx.
Date: Wed, 21 Apr 2010 16:50:11 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 04/21/2010 05:21 AM, Simon Josefsson wrote:
>> For some reason 'asprintf (&tmp, "%08lx", 1)' yields '61fdec00003039'.
>> I haven't started debugging the printf code yet, but will get to it...
>
> Is this on a 32-bit or 64-bit platform?  It matters if you are asking to
> print a 64-bit long, but passed a 32-bit int.  To be safe, you should be
> using 1L or even 1UL to match the %lx.

My system is all 32-bit (debian i386 unstable).  Using 1UL or even using
a 'long int l = 12345' and passing that as a parameter to asprintf
doesn't change anything.  It could also be a MinGW compiler bug --
building this under Cygwin on native Windows works fine.  It is not a
Wine bug, transferring the generated .EXE file to a Windows system fails
the same way.

My i586-mingw32msvc-gcc --version says:
i586-mingw32msvc-gcc (GCC) 4.2.1-sjlj (mingw32-2)

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]