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

Stefan Glienke sglienke at dsharp.org
Tue Apr 17 14:47:02 CEST 2018


That compiles as well because Pointer(0) is converted by the compiler to 
nil.

There is even a dedicated warning for this when used in a const:

http://docwiki.embarcadero.com/RADStudio/Tokyo/en/W1013_Constant_0_converted_to_NIL_(Delphi)


Am 17.04.2018 um 13:24 schrieb Martok:
> Am 17.04.2018 um 11:52 schrieb Stefan Glienke:
>> FWIW this has been changed in Delphi 10.2 and does not compile anymore but gives:
>> E2010 Incompatible types: 'Dynamic array' and 'Pointer'
> That is what I would have expected.
> Could you please test what the following does in D10.2?
>
> var arr: array of byte;
> begin
>    arr:= Pointer(0);
> end.
>
> What I'd like to know: do they check the "nil" literal, or pointers of value nil?
>


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus




More information about the fpc-devel mailing list