Delphi Tokyo:

Delphi Tokyo:


var
a: array of Integer;
b: array of Integer;
begin
a := pointer(b);
end.

I'm getting E2010 Incompatible types: 'Dynamic array' and 'Pointer'.

Any idea ?

Comments

  1. As designed - they disabled assigning untyped pointer to a dynamic array because the operation you are doing there is actually unsafe. Use TArray.

    And when I saw they fixed that I thought by myself: "who the heck would ever do that..." I guess there always is (or was) a crazy developer out there that did that - should have known better by now. ;)

    ReplyDelete
  2. Thank you Stefan Glienke​, will adapt this code (3rd party)

    ReplyDelete
  3. Sounds as expected to me. I don't know what assigning a pointer to a dynamic array is suppose to do - unless it is the nil constant.

    ReplyDelete
  4. As Stefan mentioned. If you want, you can still use a hard cast and convert like it was done before, but clearly not recommended.

    ReplyDelete
  5. Marco Cantù Yes, because such hard cast is messing with the reference counts, IIRC.

    ReplyDelete

Post a Comment