[Patches] printf("%lx") -> printf("%p") for pointers : win64 cares
Tim Peters
tim_one@email.msn.com
Sat, 13 May 2000 02:21:55 -0400
[Trent Mick, patches Python to use %p for pointer printing]
> ...
> The changes do not only affect Win64 (as one would hope) because the
> %p formatter on *NIX (on Linux32 and Linux64 at least) seems to
> prepend '0x' to the hex representation of the pointer. WIn32 and Win64
> do NOT prepend this. Go figure.
Unfortunately, the C committee refused to define what %p conversion "looks
like" -- they explicitly allowed it to be implementation-defined. Older
versions of Microsoft C even stuck a colon in the middle of the address (in
the days of segment+offset addressing)!
> However, does it matter that the hex output format now includes
> the '0x' prefix on Linux32?
Well, gratuitous (from a Linux32 user's POV) change can't be considered a
good thing.
> I.e. does Python promise the repr output to look EXACTLY the way it does?
No.
> Will reasonable code out there break?
Probably, but not much. I'm sure much more code will break due to 1.6
dropping the trailing "L" on str(long), for example.