Why is gcc going to default to "GNU dialect of ISO C99?"

Dr. David Kirkby david.kirkby@onetel.net
Wed Feb 10 17:45:00 GMT 2010


Andrew Haley wrote:
> On 02/10/2010 04:44 PM, Dr. David Kirkby wrote:
>> According to
>>
>> http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options
>>
>> -std=foobar
>>
>>
>> `gnu9x'
>>     GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
>> this will become the default. The name `gnu9x' is deprecated.
>>
>> I really can not understand the logic of this. Why not default to ISO
>> C99 and let people enable GNUisms if they wish to? Then code should be
>> more portable across different compilers. With the GNUisms allowed by
>> default, it will make porting code more difficult to other stricter
>> compilers.
> 
> This reasoning would make perfect sense if the primary goal of gcc's
> users was to write code to be ported to other compilers. 

I thought gcc's primary aim was to be a *C* compiler. That would suggest to me 
that enabling GNU extensions should not be the default, but an option.

A lot of bugs are often discovered in code by testing on multiple compilers and 
multiple platforms. What one compiler misses, another finds. I could point you 
to various cases where the Sun compiler has rejected erroneous code that gcc has 
permitted. I'm sure you could no doubt find counter examples too.

By generating code that should build with other compilers, problems can be 
detected more easily.

> However,
> many of GNU C's extensions are very useful, so it makes sense to have
> them available by default.  (Having said that, many of GNU C's
> extensions are part of C99 anyway, so the difference is smaller than
> with C89.)

Personally I feel this is a bad decision, but I'm not a gcc developer.

Dave



More information about the Gcc-help mailing list