[fpc-pascal]2 questions on ansistrings
Marco van de Voort
marcov at stack.nl
Thu Aug 28 08:49:31 CEST 2003
> 1. If a segment is deleted from an ansistring, e.g. ...
> s := 'abcdefghijklmnop';
> delete (s, 5, 6);
> yielding s = 'abcdelmnop'
> ...does the system "shift" the 'lmnop' to the left, or does the string
> get hooked together with pointers, thus saving much time with long strings?
No shifting, ansistrings are not sparse (at least not in this implementation.
Note that sparse strings save time with this kind of operations, but
cost quite some extra time when parsing them.
> 2. Is there any documentation yet of the ansistring internals? If not,
> what file contains the source?
I don't know, but the file is inc/astrings.inc Maybe there are some
asm parts in <processor>.inc too
The idea is quite simple. Ansistrings essentially are pchars, with
alloocation size, length and reference count prefixed on negative
offsets of variable^.
The fact that it has the length, also means that it can contain any
More information about the fpc-pascal