Next: , Previous: Constant aggregates with unconstrained nominal types, Up: Code Generation for Array Aggregates


14.4.3 Aggregates with static bounds

In all previous examples the aggregate was the initial (and immutable) value of a constant. If the aggregate initializes a variable, then code is generated for it as a combination of individual assignments and loops over the target object. The declarations

            Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
            Cr_Var2 : One_Dim := (others > -1);

generate the equivalent of

            Cr_Var1 (1) := 2;
            Cr_Var1 (2) := 3;
            Cr_Var1 (3) := 5;
            Cr_Var1 (4) := 11;
     
            for I in Cr_Var2'range loop
               Cr_Var2 (I) := -1;
            end loop;