On 2018-02-02, at 02:24:51, Bernd Oppolzer wrote:
> My string implementation uses two length fields in front of every string,
> the first being the maxlength field, which tells the maximum length that the
> string can hold, and the second one is the actual length, which obviously 
> should
> be less or equal to the maxlength. Both length fields are two bytes, like in 
> PL/1 varchars,
> so a string can by up to 32767 bytes in length. A string variable defined as 
> STRING (20)
> occupies 24 bytes.
That does not support defining substrings without copying.

Why limit to 32767 (or even 65535)?

On 2018-02-02, at 06:28:54, Martin Ward wrote:
> The original Pascal string used a single byte for the length
> at a time when a $70K machine had a mere 4K words of memory.

I don't recall seeing that in Wirth's Pascal User Manual and Report,
which I consider to describe the "original Pascal".  And:

    Early Pascal compilers
    The first Pascal compiler was designed in Z├╝rich for the CDC 6000 series
    mainframe computer family.

Hardly computers of the scale you're considering.

On 2018-02-01, at 20:13:21, Robin Vowels wrote:
>     ...
>> o It should be two pointers, first byte and last byte + 1.
> The address of the start of the string and the length are probably better.

I may have been biased by the Block Transfer instruction of the PDP-6 whose
Block Transfer instruction, interruptible like MVCL, used front and back
pointers.  One register fewer to update on interrupt at the cost of one
instruction more for strlen().

Using two pointers avoids tempting implementers with the false economy of
chiseling a few bits from the length field for flags or simply to save a
byte.  How did MVCL deal with such restrictions on XA?

How should strings crossing segment boundaries be supported (286? ESA?)

-- gil

Reply via email to