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 ?
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 ?
As designed - they disabled assigning untyped pointer to a dynamic array because the operation you are doing there is actually unsafe. Use TArray.
ReplyDeleteAnd 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. ;)
Thank you Stefan Glienke, will adapt this code (3rd party)
ReplyDeleteRaise a glass to Emba for this one.
ReplyDeleteIs it still possible to assign nil?
ReplyDeleteSounds 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.
ReplyDeleteCompiler change? docwiki.embarcadero.com - What's New - RAD Studio
ReplyDeleteAs Stefan mentioned. If you want, you can still use a hard cast and convert like it was done before, but clearly not recommended.
ReplyDeleteMarco Cantù Yes, because such hard cast is messing with the reference counts, IIRC.
ReplyDelete