C Standards & GNU Extensions

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

 



Hi,

I have a question regarding the support of non-standard C features in GCC. In 
the info pages to gcc-4.0 it says "Use of the `-std' options listed above
will disable these extensions where they conflict with the C standard
version selected." (Node "Standards"). From this I assumed that to disable an 
extension means to not compile a code that makes use of that extension or at 
least print a warning message.

However, this code compiles fine with "gcc -c -std=c89"

struct s {
        int i;
};

struct s s1 = {.i=1};

It specifies a structure member in an initialization which is forbidden 
according to the message I get when I add "-pedantic": "gnu.c:5: warning: 
ANSI C forbids specifying structure member to initialize".

Did I misunderstand the documentation for "-std"? How do I need to call GCC in 
order to only compile source that complies with the selected standard? Is 
adding "-pedantic-errors" sufficient?

Frank

Attachment: pgpiAvWvXYMcy.pgp
Description: PGP signature


[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