Re: GCC accepts dynamically-sized array in sizeof with -std=c89

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Igor Bukanov wrote:
With GCC 4.3.0 it compiles without a warning even with -pedantic
-std=c89 even if the program uses dynamic array feature from C99:

It works for me.

localhost$ ./xgcc -B./ -std=c89 tmp2.c
localhost$ ./xgcc -B./ -std=c89 -pedantic tmp2.c
tmp2.c: In function ‘f’:
tmp2.c:5: warning: ISO C90 forbids variable length array
localhost$ ./xgcc -B./ -v
Reading specs from ./specs
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=c
Thread model: posix
gcc version 4.3.1 20080411 (prerelease) [gcc-4_3-branch revision 134209] (GCC)

Adding -pedantic does generate the warning. Perhaps you expected a warning without -pedantic? If you read the docs carefully, you will see that -std=c89 enables all features of that standard, but does not disable GNU extensions to that standard. You need -pedantic for that.

Jim

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux