--- Comment #2 from Vladimir Panteleev <> 2012-07-13 
13:36:05 PDT ---
> to!string should take null-terminated string and give you a string, and it 
> does
> that. This code passes:

Is it something that was fixed recently (within the last two weeks)? My
two-week-old dmd git build and dpaste still print offsets for wchar* and

> So, you expect %s on a pointer to give you the string that it points to? Why?

I think that, before all else, we should be looking for good reasons why
format("%s", foo) and to!string(foo) produce different results. Why should one
format the offset and the other do a conversion?

Second, I believe that the principle of least surprise is making this case
rather clear: if the programmer tries to print a char*, it's almost certain
that they want to print the null-terminated string at the given address, rather
than a hexadecimal representation of the address (which are rarely useful to
the end-user). Generic code is the only exception I can think of, in which case
a cast to void* is in order.

> What _doesn't_ work is this:

I think this should call the appropriate toUTFx functions from std.utf.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to