Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 28 Oct 2013 22:46:18 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Cc: Matthew Fernandez <matthew.fernandez@...ta.com.au>
Subject: Re: printf format macros

On Tue, Oct 29, 2013 at 01:28:22PM +1100, Matthew Fernandez wrote:
> Hi all,
> 
> This may be a silly question, but why does there seem to be no 64-bit
> compatibility in the printf macros in inttypes.h? The relevant section is:
> 
> 25 #if UINTPTR_MAX == UINT64_MAX
> 26 #define __PRI64  "l"
> 27 #else
> 28 #define __PRI64  "ll"
> 29 #endif
> 
> as compared to Glibc's:
> 
> 49 # if __WORDSIZE == 64
> 50 #  define __PRI64_PREFIX    "l"
> 51 #  define __PRIPTR_PREFIX   "l"
> 52 # else
> 53 #  define __PRI64_PREFIX    "ll"
> 54 #  define __PRIPTR_PREFIX
> 55 # endif
> 
> We use Musl C on 32- and 64-bit platforms and I'm looking for a way to
> write printf format strings word-length-independently in an application.
> I'm not currently subscribed to the list so please CC me personally when
> replying.

I was at first confused, but it looks like the PRI?PTR macros are
incorrect on musl for 32-bit archs. At worst you'll get warnings, so
you can use them all correctly right now, but it's something we should
fix before the next release.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.