How to use C89 with certain C99 features

richardcavell@mail.com richardcavell@mail.com
Tue Apr 5 10:32:00 GMT 2011


Hi, everyone.  I'm building a project in C.  My idea is that I want it 
to be mostly C89, except that I will be using certain features of C99.  
What compiler flags do I need to tell GCC what I want?

At present, if I compile with -std=c99, I get no errors or warnings at 
all.  If I compile with -std=c89, I get the following warnings:

(When I use macros with ... and __VA_ARGS__)
warning: anonymous variadic macros were introduced in C99

(When I use long string literals)
warning: string length '613' is greater than the length '509' ISO C90 
compilers are required to support

(When I use vsnprintf)
warning: implicit declaration of function 'vsnprintf'

(When I initialize a struct with run-time data)
warning: initializer element is not computable at load time

Richard



More information about the Gcc-help mailing list