I was wondering about an initialization of the following form:
int array[] = {
v - 1,
array[0] + 1
} ;
In the initialization of the second element, the value of the first is used, but the entire array is not yet initialized. This happens to compile with g++, but I was unsure whether this is actually portable and a well defined construct?
See 3.3.2 Point of declaration:
So you are referring to the array correctly, its name is known after the
=.Then, 8.5.1 Aggregates:
However, I see no reference to when the evaluated values are actually written into the array, so I wouldn’t rely on this and would even go so far to declare your code as not well defined.