July 22, 2010
Johannes Pfau Wrote:

> I always thought just casting to the pointer type isn't really safe. I guess you should use std.strings toStringz.
> 
> (Off topic: std.strings toStringz uses the GC to store the c string. Now if I passed the returned pointer to a C function, but didn't store a reference in the D program, couldn't that c string get collected while the c library would expect it to be still there?)
> -- 
> Johannes Pfau

I had my own question about toStringz, yours was one of them, the function returns a const(char)*, but C doesn't have such a notion so how is this enforced?