This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Variable length array


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)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]