5 ms·
How else would you implement them, seriously. You have two choices, counted or terminated. Counted places a complexity burden at the lowest level of coding.
by emmelaich 11y ago
How else would you implement them, seriously.
You have two choices, counted or terminated.
Counted places a complexity burden at the lowest level of coding.
With terminated you still have the option of implementing strings with structs or arrays with counts or anything.
And people did of course. Many many different implementations of safe strings exist in C; the fact that none have won out vindicates the decision to use sentinel termination.