[LCP]Variable Length Arrays in C, support as per C89/C99 in gcc
Y Giridhar Appaji Nag
Giridhar.Nag at ubinetics.co.in
Mon Jul 8 21:36:05 UTC 2002
Hi,
I have a piece of code which looks like this ...
----------- listing begin ------------
#include <stdio.h>
int main()
{
int b = 10 ;
int a[b] ;
b[0] = 12 ;
b[1] = 89 ;
b[2] = 78 ;
printf("%d, %d, %d\n", b[0], b[1], b[2]) ;
}
----------- listing end ------------
I expect that this would not work with the pure C89 compilers or
when I give the -std=c98 (or -std=iso9899:1990) to gcc. But it
looks like I am not correct (though "info gcc" says that giving
the -std=c98 or -ansi or -std=iso9899:1990 would comply to C89)
However, if I give the -pedantic option, I get a warning that
says... "ISO C89 forbids variable-size array `b'" which is ok,
but then what's with the above -std options?
I tried this with gcc 2.95.3 as well as 2.96. Any clues? Am I
doing something that is incorrect here?
-best regards,
Giridhar
--
Y Giridhar Appaji Nag Giridhar.Nag[@t]ubinetics(.)co.in
While one person hesitates because he feels inferior, another
is busy making mistakes and becoming superior. -Henry C. Link
> an individual are not necessarily those of UbiNetics
More information about the linuxCprogramming
mailing list