Code:
procedure TForm3.Button1Click(Sender: TObject);
const
// 20 Items
A: array [0..19] of Single = (
0.5, 0.5, 0.5, 0.5, 0.5,
0.5, 0.5, 0.5, 0.5, 0.5,
0.5, 0.5, 0.5, 0.5, 0.5,
0.5, 0.5, 0.5, 0.5, 0.5
);
var
B: Array of Single;
I: Integer;
begin
// 20 Items for B also
SetLength(B, 20);
// Ok just to make sure fill B with same
for I := 0 to 19 do
B[I] := 0.5;
Log('SizeOf A: ' + IntToStr(SizeOf(A))); // -> 80
Log('SizeOf B: ' + IntToStr(SizeOf(B))); // -> 8
end;
What is this? Why such a huge difference? I can't pass my dynamic array to something expecting the 'A' type.
Bookmarks