|
Message-ID: <loom.20140114T212850-606@post.gmane.org> Date: Tue, 14 Jan 2014 20:36:36 +0000 (UTC) From: David Wuertele <dave+gmane@...rtele.com> To: musl@...ts.openwall.com Subject: Am I using PRIxPTR wrong? Musl-libc complains, glibc doesn't /* 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; }
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.