Well, then we're going to have to agree to disagree on that one. While some design decisions may have made more sense at the time they were made or the ultimate pros and cons may not have been clear at the time, I think that zero- terminated strings are one of the design decisions which was truly short- sighted and an enormous mistake all around, and all C/C++ programmers have had
to pay for it ever since.

- Jonathan M Davis

I agree, despite the fact that it allows, in principle, creating strings as long as desired with constant cost (just one byte is sacrificed, instead of one, two, three, four etc. required to represent the length). Besides, using zero-terminated strings did not impose, in principle (forget about machine addressing issues) no upper bound on the length of a string.

But, OTOH, it was also the only way to do it once the decision to not incorporate length in arrays (basically, under the assumption: an array is a pointer and nothing more) was made.


Reply via email to