www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Re: SQLite 3.6.23.1 wrapper + connector

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?
Jul 21 2010