|
|
@@ -33,13 +33,13 @@ void foo() \{
|
|
|
A more complex class of initialisations is that of array initialisations.
|
|
|
Arrays can be initialised to a scalar value or to an array literal in
|
|
|
bracket notation. A scalar value is rewritten to a nested for-loop over all
|
|
|
- array dmensions, with an assignment in the most nested loop. An array
|
|
|
+ array dimensions, with an assignment in the most nested loop. An array
|
|
|
constant is rewritten to a series of separate assign statements to the
|
|
|
corresponding array indices. The following example shows both
|
|
|
transformations:
|
|
|
{v void foo() \{
|
|
|
int[3] a = 4;
|
|
|
- int[2, 2] b = [[3, 4], [5, 6]];
|
|
|
+ int[2, 2] b = [[1, 2], [3, 4]];
|
|
|
\} v}
|
|
|
|
|
|
This is transformed into:
|
|
|
@@ -109,7 +109,7 @@ resulting in:
|
|
|
_a_0_ = 2;
|
|
|
_a_1_ = two();
|
|
|
_scalar_1_ = two();
|
|
|
- a := <allocate>(_a_0_, _a_1_);
|
|
|
+ a = __allocate(_a_0_, _a_1_);
|
|
|
for (int _i_2 = 0, _a_0_) \{
|
|
|
for (int _i_3 = 0, _a_1_) \{
|
|
|
a[_i_2, _i_3] = _scalar_1_;
|