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

Martok listbox at martoks-place.de
Mon Apr 16 17:21:25 CEST 2018

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

  arr: array of byte;
  arr:= Pointer(42);

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.


More information about the fpc-devel mailing list