Printing a C "string" with write(f)ln

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 9 14:39:14 PST 2016


On Tuesday, 9 February 2016 at 17:02:28 UTC, Jakob Ovrum wrote:
> to!string behaving like that was a poor design choice[1]. 
> Please use fromStringz.
>
> [1] https://github.com/D-Programming-Language/phobos/pull/1607

It's not a poor design choice. It ensures the string is handled 
by the D GC instead of the C side freeing it. `fromStringz` and 
`to!(String)` are for different cases.


More information about the Digitalmars-d-learn mailing list