Aggregates as initial value of an array
Hello!
Iβm stuck with this array construct.
Canβt find the syntax clue to initialize an array of records, with the particularity I aim to pass the array as an in out
variable, without needing to pass en extra index (ID) info.
(for K_ID in Knot_ID => ^
Compile error: missing β,β at ^
even with -gnat2022
and -gnatX
switches, or pragma Ada_2022;
subtype Knot_ID is Integer range Head_Knot .. Tail_Knot;
type Grid_Position is record
X : X_Dimension;
Y : Y_Dimension;
end record;
type Knot_record is record
ID : Knot_ID;
Pos : Grid_Position;
end record;
type Rope_array is array (Knot_ID'Range) of Knot_record;
(...)
Rope_Positions, Previous_Rope_Positions : Rope_array :=
-- (others => (ID => Head_Knot, Pos => (0,0))); --:FIXME: ID => Knot_ID'Range
(for K_ID in Knot_ID => (ID => K_ID => (ID => K_ID, Pos => (0,0))));
see Ada 2012/2012 Array Aggregates
see Overview of Ada 2022
Compiler is FSF gcc-gnat 12.2.0
William
3 posts - 2 participants