[fpc-pascal] Pchar from constant string
genericptr at gmail.com
Fri Jun 30 04:03:42 CEST 2023
> On Jun 29, 2023, at 9:31 PM, Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> Yes, it is:
> #  p := '123';
> .ascii "123\000"
> Just as it is for a shortstring and ansistring:
> #  s:='456';
> .ascii "\003456\000"
> .size _$PROGRAM$_Ld2, .Le12 - _$PROGRAM$_Ld2
That's why that worked. Hmm with short strings the null terminator could be truncated when copying right? Something to look out for.
More information about the fpc-pascal