I am trying to enter constant array of some type, where I would enter all elements in code. This works fine if I enter the number of array elements (like with MyArr: array[1..3] of TPoint), but I will maintain an array in code that will grow in elements. Sometimes I will have to add 5 elements, sometimes more. Right now I have to increase manually higher array index. I have tried various methods trying to avoid this, but no luck. Is there some way to acomplish this? Something like M5Arr: array[] of TPoint?
Code
type
TPoint = record
X, Y, Z: integer;
end;
const
APoint: TPoint = (X : 0; Y : 2; Z : 4); // compiles
MyArr: array[1..3] of TPoint = ((X: 0; Y: 2; Z: 4), // compiles
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
M1Arr: array[1..SizeOf(longword) div 2] of byte = (2, 3); // compiles
M2Arr: array[1..High(M2Arr)] of TPoint = ( // internal compiler error
(X: 0; Y: 2; Z: 4),
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
M3Arr: array[1..Length(M3Arr)] of TPoint = ( // internal compiler error
(X: 0; Y: 2; Z: 4),
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
M4Arr: array[1..SizeOf(M4Arr) div SizeOf(TPoint)] of TPoint = ( // internal compiler error
(X: 0; Y: 2; Z: 4),
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
M5Arr: array[] of TPoint = ( // identifier expected error
(X: 0; Y: 2; Z: 4),
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
TPoint = record
X, Y, Z: integer;
end;
const
APoint: TPoint = (X : 0; Y : 2; Z : 4); // compiles
MyArr: array[1..3] of TPoint = ((X: 0; Y: 2; Z: 4), // compiles
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
M1Arr: array[1..SizeOf(longword) div 2] of byte = (2, 3); // compiles
M2Arr: array[1..High(M2Arr)] of TPoint = ( // internal compiler error
(X: 0; Y: 2; Z: 4),
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
M3Arr: array[1..Length(M3Arr)] of TPoint = ( // internal compiler error
(X: 0; Y: 2; Z: 4),
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
M4Arr: array[1..SizeOf(M4Arr) div SizeOf(TPoint)] of TPoint = ( // internal compiler error
(X: 0; Y: 2; Z: 4),
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));
M5Arr: array[] of TPoint = ( // identifier expected error
(X: 0; Y: 2; Z: 4),
(X: 5; Y: 1; Z: 0),
(X: 2; Y: 2; Z: 2));