[fpc-devel] is strnew delphi-compatible?
Marco van de Voort
marcov at stack.nl
Thu May 8 10:56:10 CEST 2008
> TurboPascal and Delphi differ in the way they do strnew.
> Delphi allocates additional two bytes preceding the first
> character to store the length of the string.
> The turbo pascal docs say:
> The allocated space is StrLen(Str) + 1 bytes long.
> The delphi docs say:
> A 16-bit number giving the total amount of memory allocated is stored
> in the two bytes preceding the first character; it is equal to Size+2.
Note that Delphi stores the size of every allocation at $-4. (and maybe $-2
in 16-bit Delphi). However this is done by the heapmanager, not strnew.
If this is meant, it can still be perfectly compatible.
More information about the fpc-devel