This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C Standards & GNU Extensions


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: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]