[fpc-devel] Type Compatibility: dynarray <=> Pointer

Stefan Glienke sglienke at dsharp.org
Tue Apr 17 11:52:39 CEST 2018


FWIW this has been changed in Delphi 10.2 and does not compile anymore but gives:
E2010 Incompatible types: 'Dynamic array' and 'Pointer'

> On 16 April 2018 at 17:21 Martok <listbox at martoks-place.de> wrote:
>
>
> Hi all,
>
> I have started debugging 0031215, and discovered something slightly unrelated,
> but odd. I hope someone can clear that up.
> While testing, I found out that the following compiles, and becomes a call to
> fpc_dynarray_assign:
>
> var
> arr: array of byte;
> begin
> arr:= Pointer(42);
> end.
>
> This eventually happens because of the conversion case arraydef<=pointerdef in
> defcmp.pas:1151, where a comment says: "nil and voidpointers are compatible with
> dyn. arrays". This comment was there since the very first SVN import.
>
> My question: why *are* voidpointers assignment compatible to dynarrays? It does
> seem to be Delphi compatible, but I couldn't find any mention in either
> documentation that this is possible - only the reserved/constant "nil" is
> compatible, and handled elsewhere.
>
> --
> Regards,
> Martok
>
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel



More information about the fpc-devel mailing list