Arrays: Delphi <>Oxygene

Hi,

porting parts of a foreign delphi(2007) unit presents me with an unexpected problem (simplified code):

type
TOneDim = array[0…3] of Single;
TTwoDim = array[0…3] of TOneDim;
TArrayTest = class
public
method DoSomething;
end;

implementation

method TArrayTest.DoSomething;

var
vcTwoDim : TTwoDim;
begin
vcTwoDim[1,2] := 47.11;
writeLn(vcTwoDim[1,2].ToString);

end;

This works as expected in Delphi - … but not so in Oxygene:

image

In Oxygene i have to explicitly construct the TOneDim´s.
I’m not sure if that’s really what you want…???

Thanks in advance for clarifying this,
Werner

Curious. fixed arrays (with well-determined bounds) afaik should be stack-based and not need allocation. I’ll have that checked into with the compiler team.

Ah it seems that these first two are stack-alloc’ed, but the “array of array” is not.

      var x: array[0..5] of Integer;
      x[1] := 5;

      var a: array[0..5, 0..8] of Integer;
      a[1,5] := 5;

      var y: array[0..5] of array [0..8] of Integer;
      y[1,5] := 5;  //NRE
1 Like

Logged as bugs://E26125.