On 09/10/16 08:50, Sven Barth wrote:
Am 08.10.2016 22:48 schrieb "Ched"
<charles.edouard.des.vastes.vig...@gmail.com
<mailto:charles.edouard.des.vastes.vig...@gmail.com>>:
In http://www.freepascal.org/docs-html/ref/refsu14.html#x37-400003.2.8
, the stack sized used by a Shortstring is Declared length + 2 . Why not
Declared length + 1 ?

1 Byte length and a zero byte to allow easy conversion to PChar.

That is incorrect. Shortstring stringconstants are stored like that in the constant data section so they can be used both for assigning to shortstrings and to pchars, but shortstring variables/fields themselves are never null-terminated by the compiler/RTL.

So there is in fact an error in the documentation: it should be length + 1.


Jonas

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to