mailing list of musl libc
 help / color / mirror / code / Atom feed
* Am I using PRIxPTR wrong?  Musl-libc complains, glibc doesn't
@ 2014-01-14 20:36 David Wuertele
  2014-01-14 20:59 ` Rich Felker
  2014-01-14 21:06 ` Szabolcs Nagy
  0 siblings, 2 replies; 7+ messages in thread
From: David Wuertele @ 2014-01-14 20:36 UTC (permalink / raw)
  To: musl

/* test.c - demo difference between glibc and musl-libc wrt PRIxPTR
**
** Both native (x86_64 glibc) and target (arm musl-libc) define
** PRIxPTR as "lx", but uintptr_t as unsigned int:
**
**   $ gcc -E test.c | grep uintptr_t
**   typedef unsigned long int uintptr_t;
**     printf ("main is at 0x%""l" "x""\n", (uintptr_t) main);
**
**   $ arm-linux-musleabishf-gcc -E test.c | grep uintptr_t
**   typedef unsigned int uintptr_t;
**     printf ("main is at 0x%""lx""\n", (uintptr_t) main);
**
** While native gcc doesn't complain, target gcc does:
** 
**   $ gcc -c test.c -Wformat
**
**   $ arm-linux-musleabishf-gcc -c test.c -Wformat
**   test.c: In function ‘main’:
**   test.c:6:3: warning: format ‘%lx’ expects argument of type
** ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Wformat]
*/

#include <stdio.h>
#include <inttypes.h>
int
main (int ac, char *av[])
{
  printf ("main is at 0x%"PRIxPTR"\n", (uintptr_t) main);
  return 0;
}




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

end of thread, other threads:[~2014-01-14 21:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-14 20:36 Am I using PRIxPTR wrong? Musl-libc complains, glibc doesn't David Wuertele
2014-01-14 20:59 ` Rich Felker
2014-01-14 21:06 ` Szabolcs Nagy
2014-01-14 21:20   ` Rich Felker
2014-01-14 21:37     ` David Wuertele
2014-01-14 21:45       ` Rich Felker
2014-01-14 21:34   ` David Wuertele

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).