mailing list of musl libc
 help / color / mirror / code / Atom feed
* printf format macros
@ 2013-10-29  2:28 Matthew Fernandez
  2013-10-29  2:46 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Fernandez @ 2013-10-29  2:28 UTC (permalink / raw)
  To: musl

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.

Thanks in advance,
Matthew

________________________________

The information in this e-mail may be confidential and subject to legal professional privilege and/or copyright. National ICT Australia Limited accepts no liability for any damage caused by this email or its attachments.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: printf format macros
  2013-10-29  2:28 printf format macros Matthew Fernandez
@ 2013-10-29  2:46 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2013-10-29  2:46 UTC (permalink / raw)
  To: musl; +Cc: Matthew Fernandez

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-29  2:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-29  2:28 printf format macros Matthew Fernandez
2013-10-29  2:46 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).