C string to D without memory allocation?

Marc Schütz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 21 07:04:34 PST 2015


On Monday, 21 December 2015 at 09:46:58 UTC, Shriramana Sharma 
wrote:
> Jonathan M Davis via Digitalmars-d-learn wrote:
>
>> If it isn't, all that means is that the
>> array's capacity will be 0, so it's going to have to reallocate
>
> So it's safe to return a string produced by fromStringz without 
> having to worry that the user would append to it?

Yes.

>
> Then why is it marked @system? Only because one cannot be sure 
> that the input point refers to a valid null-terminated string?

Exactly.


More information about the Digitalmars-d-learn mailing list