2 ms·
> Add a string type and eradicate the zero terminated strings. I tried that several times in my C code. I always wound up reverting to 0 terminated strings, fo
by WalterBright 4y ago
> Add a string type and eradicate the zero terminated strings.
I tried that several times in my C code. I always wound up reverting to 0 terminated strings, for the simple reason that everything else in the C ecosystem is 0 terminated strings. For example, printf.
- db48x 4y agoYes, you still need to be able to use null–terminated strings at the edges, when you read them in or print them out. But inside your program, resizable strings that know their own length and capacity are a huge benefit.
- WalterBright 4y agoYes, that's why I'd make my own string type. But it always turned out to be more trouble than it was worth, because every other piece of C code wanted to use 0 terminated strings.