3 ms·
That's not what it's doing though. Pascal strings are: { length, pointer } In these strings: For short strings it's storing: { length, string value} fo
by xnorswap 10mo ago
That's not what it's doing though.
Pascal strings are:
{ length, pointer }
In these strings:
For short strings it's storing:
{ length, string value}
for longer strings, it's storing
{length, prefix, class, pointer }
- masklinn 10mo ago> Pascal strings are: { length, pointer } The historical P-strings are just a pointer, with the length at the head of the buffer. Hence length-prefixed strings, and their limitation to 255 bytes (only one byte was reserved for the length, you can still see this in the most base string of freepascal: https://www.freepascal.org/docs-html/ref/refsu9.html https://www.freepascal.org/docs-html/ref/refsu9.html). {length, pointer} or {length, capacity, pointer} is struct / record strings, and what pretty much every modern language does (possibly with optimisations e.g. SSO23 is basically a p-string when inline, but can move out of line into a full record string).