Re:C’s Biggest Mistake
by kevin_thibedeau on Sunday July 02, 2023 @09:59PM
(#36567814)
You can modify the length of NUL strings in place by inserting a new NUL or overwriting past the end without any other bookkeeping. You can split a string on delimiters simply by overwriting them with NULs.
[ Parent
| on HN ]
Re:C’s Biggest Mistake
by jrpelkonen on Sunday July 02, 2023 @10:31PM
(#36568023)
I find these arguments rather weak. I don’t see how writing a NUL is any more efficient compared to updating a length. Furthermore, having the terminators in-band prevent the character data to be used for multiple substrings. E.g. in the split example the original string is no longer available.