|
@@ -44,8 +44,8 @@ void foo() \{
|
|
|
This is transformed into:
|
|
This is transformed into:
|
|
|
|
|
|
|
|
{v void foo() \{
|
|
{v void foo() \{
|
|
|
- int[] a;
|
|
|
|
|
- int[] b;
|
|
|
|
|
|
|
+ int[3] a;
|
|
|
|
|
+ int[2, 2] b;
|
|
|
a = __allocate(3);
|
|
a = __allocate(3);
|
|
|
for (int i = 0, 3) \{
|
|
for (int i = 0, 3) \{
|
|
|
a[i] = 4;
|
|
a[i] = 4;
|
|
@@ -57,6 +57,13 @@ void foo() \{
|
|
|
b[1, 1] = 4;
|
|
b[1, 1] = 4;
|
|
|
\} v}
|
|
\} v}
|
|
|
|
|
|
|
|
|
|
+ Actually, the dimensions of [a] and [b] should have been replaced by new
|
|
|
|
|
+ variables earlier for reasons described below, but this is not done in the
|
|
|
|
|
+ example to maintain readability.
|
|
|
|
|
+
|
|
|
|
|
+ Note that array constants in bracket expressions must have a nesting level
|
|
|
|
|
+ that is equal to the number of array dimensions, or an error will occur.
|
|
|
|
|
+
|
|
|
{2 Prevent incorrect double evaluation}
|
|
{2 Prevent incorrect double evaluation}
|
|
|
|
|
|
|
|
In the following code:
|
|
In the following code:
|