On Saturday, 29 September 2012 at 02:07:38 UTC, Andrej Mitrovic
wrote:
I've noticed I'm having to do a lot of to!string calls when I
want to
call the versatile writef() function. So I was thinking, why not
introduce a special zero-terminated string specifier which
would both
alleviate the need to call to!string and would probably save on
needless memory allocation. If all we want to do is print
something,
why waste time duplicating a string?
I just checked and std.conv.to always allocates a copy, even when
constness doesn't require it. It should not reallocate when
constness doesn't change, or is a safe conversion (e.g. immutable
-> const).
A discussion on a related topic (formatting of C strings results
in unexpected behavior) is here:
http://d.puremagic.com/issues/show_bug.cgi?id=8384