When I was a lot younger I wrote C string handling libraries that I used for my own projects or for work projects.
-
When I was a lot younger I wrote C string handling libraries that I used for my own projects or for work projects. I have Opinions™ about this. But it's no longer a battle I care to engage in. There is no way to win, without leaving C behind.
-
C strings are a sequence of bytes ending in a zero byte. It's awkward, cumbersome, error prone & stupid in many ways, but in the early 1970s, having strings with a length field was expensive. When your biggest computer has about 9 KiB of RAM, spending two or four bytes to express the length of a string was hideously expensive. A one byte terminator was the cheapest option in terms of memory use.
There's more resources available today, but entrenched fundamentals are quite difficult to change.
-
This remembers me of Bob Bemer, who in 1958 (!!!) warned about the Y2K problem.