[PATCH] fix printf "%p" output on 64-bit platform

Roman Kononov roman at xtremedatainc.com
Mon Jan 29 04:57:19 UTC 2007


On Mon, 29 Jan 2007 11:36:27 +0900 (JST) Atsushi Nemoto <anemo at mba.ocn.ne.jp> wrote:
> It worked fine on 64-bit platform, but on 32-bit platform (mipsel,
> mips64el(n32)), I got:
> 
> libc/stdio/_load_inttype.c: In function '_load_inttype':
> libc/stdio/_load_inttype.c:16: error: size of array 'test_t' is negative
> libc/stdio/_load_inttype.c:17: warning: cast from pointer to integer of different size

If it still matters, I made a mistake.
There should be
	typedef char test_t[sizeof(void*)>sizeof(uintmax_t)?-1:1];
instead of
	typedef char test_t[sizeof(void*)<sizeof(uintmax_t)?-1:1];

If pointers are longer than uintmax_t, the compiler should try
"typedef char test_t[-1]", which must produce compile time error.
	
Regards, Roman



More information about the uClibc mailing list