Thread overview | |||||
---|---|---|---|---|---|
|
April 03, 2005 std.format %p and TypeInfo_P | ||||
---|---|---|---|---|
| ||||
I'm getting tired of typing %#010x and casting so I can format pointers and having this FormatSpecification not be portable to 64-bit pointers. I looked at std.format.doFormat and it seems most of what's needed for a 'p' FormatChar is there (everything except for switching for 'p' at the Lnumber: label, it seems) ('p' is even already checked for on line 472 of format.d but not used otherwise). But the TypeInfo of pointer types isn't using TypeInfo_P, just the base TypeInfo, and doFormat needs the TypeInfo's classinfo.name.length >= 10 so it can deduce the type from the 10th char, otherwise it fails; so it seems TypeInfo_P for pointer types is also needed before formatting them can work. Does anyone else feel the need for std.format to do pointers? |
April 03, 2005 Re: std.format %p and TypeInfo_P | ||||
---|---|---|---|---|
| ||||
Posted in reply to derick_eddington | derick_eddington wrote:
> Does anyone else feel the need for std.format to do pointers?
I do, since it's absolutely necessary for std.unformat to work!
It's not so much that std.format needs to support pointers, but
that D's TypeInfo for pointers (in general) need to be fixed...
--anders
|
April 03, 2005 Re: std.format %p and TypeInfo_P | ||||
---|---|---|---|---|
| ||||
Posted in reply to derick_eddington | In article <d2o4u8$1vc4$1@digitaldaemon.com>, derick_eddington@nospam.yasmhoo.com says... >Does anyone else feel the need for std.format to do pointers? > Oh god yes. I'm sick of typing "%0.8X" for every address I want to look at. It would be nice if I could do something like this instead: > int foo; > format("%p",&foo); output: > (int*)0x12345678 - EricAnderton at yahoo |
Copyright © 1999-2021 by the D Language Foundation