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

Dennis Clarke dclarke@blastwave.org
Thu Feb 11 14:50:00 GMT 2010


> On Thu, Feb 11, 2010 at 8:00 PM, Dennis Clarke <dclarke@blastwave.org>
> wrote:
>>
>>> On Thu, Feb 11, 2010 at 7:40 PM, Dennis Clarke <dclarke@blastwave.org>
>>> wrote:
>>>>
>>>>> It all reminds me a story when I won a bottle of beer from my
>>>>> scientific adviser back in 2005. We had a bet: will gcc compile this
>>>>> code:
>>>>> #include <stdio.h>
>>>>>  int main() {
>>>>>   printf("a");
>>>>>   int a;
>>>>>   printf("b");
>>>>>   return 0;
>>>>> }
>>>>> He was so sure that gcc won't allow it that didn't ever tried :)
>>>>> Thus,
>>>>> I think gnu extensions by default are not so bad :)
>>>>>
>>>>> Alexey
>>>>
>>>> Let's have a look at that. I don't see any issues really. You call
>>>> printf() with a literal string, then define some simple integer, then
>>>> print another literal string with a call to printf() and finally
>>>> return
>>>> back to the calling process with a status of 0. Very nice.
>>>>
>> <snip>
>>>
>>> 334 lines of research for 7 lines of code :)
>>>
>>> Alexey
>>
>> Here are 7 more :-)
>>
>> $ lint -v -Nlevel=4 -Xc99=all sample1.c
>>
>> variable unused in function
>>    (9) a in main
>>
>> function returns value which is always ignored
>>    printf
>>
>>
>> --
>> Dennis Clarke
>> dclarke@opensolaris.ca  <- Email related to the open source Solaris
>> dclarke@blastwave.org   <- Email related to open source for Solaris
>>
>>
>>
>
> What for? If you read my messages carefully you'll understand that I
> know it works with gcc perfectly. Actually I've won a bottle of beer
> due to that knowledge :)
> But try to compile that code with MSVS for instance (or try reading
> C89 standard) and you'll see why it was possible that it would NOT
> work.
>
> Alexey

               point missing, you are

While you, as an intelligent human, may be able to understand those four
words and one punctuation mark you must agree that it is badly formed
english. In fact, it is horribly wrong from the perspective of grammer and
syntax.

The fact that some compiler somewhere may be able to compile some badly
formed code does not mean that the compiler is good. It does not even mean
that what the compiler is doing is correct.

A programming language, unlike a spoken or written language, must be
precise in its syntax and grammer in the same way that mathematics is a
precise language. A person may be able to interpret poorly formed spoken
or written language but a computer programming language should be portable
and correctly formed. Again, I may be wasting my efforts here because the
GCC developers may have left such ideals long behind them.

-- 
Dennis Clarke
dclarke@opensolaris.ca  <- Email related to the open source Solaris
dclarke@blastwave.org   <- Email related to open source for Solaris




More information about the Gcc-help mailing list