www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.format %p and TypeInfo_P

reply derick_eddington nospam.yasmhoo.com writes:

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?
Apr 02 2005
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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
Apr 02 2005
prev sibling parent pragma <pragma_member pathlink.com> writes:
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
Apr 03 2005