[BUG] int i; float a[i];
Giovanni Bajo
giovannibajo@libero.it
Thu Sep 16 15:29:00 GMT 2004
Mathieu Malaterre wrote:
>>> Sorry for the subject but I really can't find any keyword to
>>> define it. Can somebody please point me to the bug in the bugzilla,
>>> since I believe this is not valid c++ code:
>>>
>>> int foo(int i)
>>> {
>>> float a[i]; //Is this valid ?
>>
>> GCC extension. Try -pedantic.
>
> Very cool! How do I find what g++ is actually doing ? It doesn't looks
> like it's calling new ...
No, it's just allocating the array on the stack. It is the same of calling
alloca(), basically. This extension is equivalent to what is called "VLA"
(variable length arrays) in C99. Google for it.
Giovanni Bajo
More information about the Gcc
mailing list