How is string from "..." different from string from a file ?

Timon Gehr timon.gehr at gmx.ch
Mon Dec 12 09:59:11 PST 2011


On 12/12/2011 06:37 PM, bearophile wrote:
> Timon Gehr:
>
>> string fragString = readText( "Shader.vert" ) ~ '\0';
>
> I think using toStringz is more self-documenting.
>
> Bye,
> bearophile

There is nothing more self-documenting than actually appending the zero. 
Claiming toStringz is better in that regard is like saying a+1 is less 
self-documenting than doAddo(a) ;)
There might be other benefits of using toStringz though, (for example, 
it won't add the zero if it is already there, but that does not apply here).


More information about the Digitalmars-d-learn mailing list