No, no and no. toUTFz could be called at compile-time. Absolutely no extra run-time allocations, absolutely no run-time overhead.

On Tue, May 15, 2012 at 11:05 PM, Jonathan M Davis <jmdavisProg@gmx.com> wrote:
On Tuesday, May 15, 2012 17:35:58 Gor Gyolchanyan wrote:
> Even if it's wrong to move writef to druntime, the toUTFz is still a very
> small word to write.

Using toStringz or toUTFz instead of having string literals be zero-terminated
would force allocating extra strings (string literals are in an RO portion of
memory - at least on Linux - so you can't append to them without
reallocating).

Making it so that string literals weren't null terminated would break a _lot_
of code for little-to-no benefit and a definite cost. I really don't see the
problem with "" being different from cast(string)[] - particularly when the
fact that "" is non-null is _useful_.

- Jonathan M Davis



--
Bye,
Gor Gyolchanyan.