The descriptor was part of the implementation, not part of the language.

Shmuel (Seymour J.) Metz

From: IBM Mainframe Assembler List <> on behalf 
of Robin Vowels <>
Sent: Thursday, February 1, 2018 10:09 PM
Subject: Re: Fair comparison C vs HLASM

From: "Paul Raulerson" <>
Sent: Friday, February 02, 2018 12:55 AM

> And as already been noted, C was first compile on a PDP-7, which had a simple 
> instruction set but
> was most definitely a CISC machine too.  ;)

> It also explains one of the reasons why strings in C are null terminated.
> There were two modes of thought back in those days, ‘Pascal’ strings,
> which have the string size encoded in a single byte at the start of the 
> string,
> and ‘C’ strings, which terminate a string with a NULL.

And PL/I strings, which used a descriptor in which the length up to 32767
was specified.

> Pascal string length was obviously limited by the max value of a byte -

The length was not embedded in the langage; it was an arbitrary limit
imposed by the implementer.
They could have, for example, used 2 bytes at the start of the string.

> null terminated strings could be just about any possible size.

Yes, but with two disadvantages -- 1. if you wanted to know the length
of the string, it was necessaary to search the entire string.
2. A byte of zero could not be part of the string -- completely
useless when processing arbitrary data (such as image data,
and compressed data).

>  Record eliminators of course, are an entirely different thing,
> but a C string could easily be a few thousand bytes long.
> Handy indeed for things like text processing, which is what the AT&T
> guys were selling Unix and C to their bosses for.

This email has been checked for viruses by Avast antivirus software.

Reply via email to