D2 toStringz Return Type

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Nov 9 06:22:58 PST 2008


ore-sama wrote:
> Andrei Alexandrescu Wrote:
> 
>>> that's because they get char buffer, not sz, so they can't
>>> determine end of buffer scanning for null (strcat does, but it's
>>> still buffer). toStringz has nothing to do with these functions.
>> Good point.
> 
> But what can really simplify interoperability is modification of cat
> and idup operators so that they allocate an extra char and write null
> to it, so toStringz can be replaced with idup ar avoided completely.

At a point we thought of quite a few schemes along those lines. At the 
end of the day, however, it's not that often one does need 
zero-terminated strings in D so it seemed onerous to do the work always 
just in case someone needs a stringz.

Andrei



More information about the Digitalmars-d mailing list