On 02/02/18 09:24, 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.
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.
Your string implementation increases the maximum string length
by a factor of 256 at a time when memory size has increased by
a factor of approximately one million.
Incidentally, perl strings can be over 4GB in length: in fact,
any size which will will fit in memory (including swap space).
Dr Martin Ward | Email: mar...@gkc.org.uk | http://www.gkc.org.uk
G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4