Variable length array
Todd Vierling
tv@pobox.com
Mon Aug 3 10:24:00 GMT 1998
On Mon, 3 Aug 1998, Luigi Pilo wrote:
: int dim;
: dim = 3;
:
: /* GNU variable length array */
: int gnu_array[dim];
You cannot have a statement before a declaration. The problem in the code
above is the same problem in the following code:
int func(void) {
int z;
callme(&z);
int y;
}
callme(&z); is a statement, which ends the declaration block. "int y;" is
an error.
Replacing the two lines at top with "int dim = 3;" will work becuase it is
no longer a statement; it would then be a declaration with initializer.
--
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)
More information about the Gcc-bugs
mailing list