On Tuesday, 21 October 2025 at 20:07:48 UTC, Steven Schveighoffer
wrote:
FWIW, this is not what happens in phobos `toStringz`, it just
appends without concern of this use case.
Phoboes writing a one maybe 3 line function as 50 lines not
withstanding `string toStringz(string s)=>s~'\0';`
As I said in a format debate thread:
The api constants here makes a worse of both worlds situation;
99.99999% your got your of block of data from os, lets say csv
but its anything. You find the comma, and because dlang has
immutable here, you cant just replace the comma with a null,
because c apis you need 1 extra space, you copy the whole thing
to make c code happy. And yes this will be true the majority of
the time.
Worse of both worlds, but the apis would be to be drastically
changed to fix.