Eric Blake <ebl...@redhat.com> 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