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

Rob Landley rob at landley.net
Tue Nov 7 23:57:24 UTC 2006


On Tuesday 07 November 2006 2:36 am, Atsushi Nemoto wrote:
> I found printf("%p", ...) prints only 32bit value on 64-bit platform
> (length of "long" and "void *" are 64 bit).
> 
> I cooked a patch, but I'm not sure this is a right place to fix.
> Please review.  Thanks.

Just an FYI:

A pointer and long should always have the same size on all Unix variants, we 
use lp64:
http://www.unix.org/whitepapers/64bit.html

So long should be 32 bit on 32 bit platforms, and 64 bit on 64 bit platforms.  
Int should always be 32 bit, and yes that is covered by a standard and you 
can rely on it.

Windows is insane of course, but at least they have an excuse:
http://blogs.msdn.com/oldnewthing/archive/2005/01/31/363790.aspx

Rob
-- 
"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery



More information about the uClibc mailing list