On 2018-01-30, at 21:17:05, Robin Vowels wrote: > On 31/01/2018 3:27 AM, Jon Perryman wrote: >> >> >> Exactly my point. I suspect that the C group considered Null-terminated >> strings cost exactly the same as fixed length fields. ... >> > But if you just want the length, a fixed-length string wins. > In PL/I, a varying-length string also wins, because the current length > is kept with descriptor, so it isn't necessary to search through the > string in order to find the end. > And strings with descriptors (address, length) make it easy to define substrings. Just create a new descriptor. A C partisan once told me, just save a character, overlay it with a NUL, then put it back when you're done with the substring.
I've used a language that defined substrings by creating descriptors, then handled garbage collection properly -- any byte not governed by one or more descriptors was subject to reclaim. -- gil
