On 2012-04-10 14:48:05 +0100, Andrew Haley wrote: > On 04/05/2012 12:30 PM, Vincent Lefevre wrote: > > On 2012-04-05 11:55:45 +0100, Andrew Haley wrote: > >> On 04/05/2012 11:50 AM, Vincent Lefevre wrote: > >>> On 2012-04-04 20:01:27 +0100, Andrew Haley wrote: > >>>> On 04/04/2012 07:11 PM, Gabriel Dos Reis wrote: > >>>>> Really? Such as what? > >>>> > >>>> Such as "I wrote a perfectly legal C program, and gcc spewed out > >>>> a ton of messages." > >>> > >>> What's a "legal C program"? > >> > >> It's generally used to mean one that is fully defined by the > >> specifications in effect, often some combination of POSIX and ISO C, > >> with perhaps some vendor extensions. Why do you ask? > > > > Because: What if the specifications in effect say (as some vendor > > extension) that some construct will generate some warning? > > Interesting. I had not considered that, but I have never seen such a > specification. Usually warnings are for things that are permitted by > a specification, but not "good" in some way. That's why warnings are > usually optional, AFAIK; the program is well-defined, but has some > properties that are, in the opinion of the compiler writer, > undesirable.
There's also the case where the program is well-defined for some specifications, but will have a different behavior with other specifications, e.g. a newer standard (like C99 vs C89) or a different one (like C++ vs C -- e.g. with MPFR, one allows it to be built with a C++ compiler). In particular in the former case, it's just C in both standards, but the concept of a "legal C program" will vary (note that the broken[*] -std cannot be used to tell GCC that the user wants to support both C89 and C99). [*] because it is not possible to distinguish between what GCC supports and what GCC allows (there have already been discussions about this). -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)