4 ms·
To be fair, agreement is not universal that null-byte termination is a good thing. Though that doesn't detract a thing from the man's greatness.
by steve-howard 15y ago
To be fair, agreement is not universal that null-byte termination is a good thing. Though that doesn't detract a thing from the man's greatness.
- adabsurdo 15y agoYes, I would say it is the single worst idea to come out of C.
- rudiger 15y agoI suspect that null-terminated byte strings are important in some non-trivial, non-obvious way.
- pavlov 15y agoC strings have certainly proved more useful than contemporary attempts like Pascal strings. Those used an integer prefix to store the length of the string, but because any language at the time was expected to provide reasonable performance on prevalent 8-bit machines, the Pascal string length field was only 8 bits. Hence strings were limited to 255 characters. The null terminator is actually an elegant machine-independent solution to this problem.
- tptacek 15y agoThe NUL terminator is an extraordinary hack, in the best sense of that word, but it is not elegant. Strings that have to be expensively interrogated to discover their length have cost the industry billions and billions of dollars due to the inevitable software faults they cause.