[fpc-pascal] Pchar from constant string
Hairy Pixels
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:
>
> ---
> _$PROGRAM$_Ld1:
> # [4] p := '123';
> .ascii "123\000"
> .Le11:
> ---
>
> Just as it is for a shortstring and ansistring:
> ---
> # [6] s:='456';
> .ascii "\003456\000"
> .Le12:
> .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.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list