From: "Paul Gilmartin" <[email protected]>
Sent: Wednesday, January 31, 2018 3:48 PM
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.
That is how strings are implemented in XPL (from c. 1966).
A substring was obtained by merely pointing a descriptor
at the first character ; the required number of characters
being inserted in the descriptor.
No characters of the string were moved.
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus