On 31/01/2018 3:27 AM, Jon Perryman wrote:
On Tuesday, January 30, 2018 8:05 AM, Paul Gilmartin
<[email protected]> wrote:
> Gil wrote: > Which of the two is to blame for null-terminated strings? >
(Or was it BCPL?)
Exactly my point. I suspect that the C group considered Null-terminated strings
cost exactly the same as fixed length fields. Ask a C program to code MVC
(memcpy) and string copy (strcpy) in C (not assembler). MVC is loop thru each
byte until length reached. String copy is loop thru each byte until X'00'. As
an FYI, MVC could be faster in some situations.
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.
XPL was the same.