C Standards & GNU Extensions

Frank Riese hippo@informatik.uni-bremen.de
Mon Feb 6 21:25:00 GMT 2006


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20060206/5a2f386f/attachment.sig>


More information about the Gcc-help mailing list