C string to D without memory allocation?

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 20 21:43:59 PST 2015

On Monday, 21 December 2015 at 05:41:31 UTC, Shriramana Sharma 
> Rikki Cattermole wrote:
>> string myCString = cast(string)ptr[0 .. strLen];
> Thanks but does this require that one doesn't attempt to append 
> to the returned string using ~= or such? In which case it is 
> not safe, right?

Growing operations like ~= will copy the array to a GC-allocated, 
druntime-managed array if it isn't one already.

More information about the Digitalmars-d-learn mailing list