Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!dcl-cs!gdt!gdr!exspes From: exspes@gdr.bath.ac.uk (P E Smee) Newsgroups: comp.lang.c Subject: Re: machine generated code and chatty compilers Message-ID: <1990Jan11.095715.17262@gdt.bath.ac.uk> Date: 11 Jan 90 09:57:15 GMT References: <1471@mdbs.UUCP> <923@thor.wright.EDU> Reply-To: exspes@gdr.bath.ac.uk (P E Smee) Organization: University of Bristol c/o University of Bath Lines: 40 In article <923@thor.wright.EDU> econrad@thor.wright.edu writes: >From article <1471@mdbs.UUCP>, by wsmith@mdbs.UUCP (Bill Smith): >> People are not the only entities that generate code for C or C++ compilers. > >So turn the warning suppression flag on for automatic-generated code. This gets to be a religious argument about the proper task for compilers. My opinion is that the flag should be a 'warning generation' flag. That is, by default the warnings should be suppressed; if you want them you should ask for them. NOTE that I am talking about WARNINGS, not ERRORS. My rationale is that the job of a compiler is to take a program source as input, and to check it *against the language spec*. If the source is conformant to the spec, the compiler should silently generate the appropriate code, as requested by the source generator (be it person, or tool). If the source is NOT conformant to the spec, the compiler should diagnose ALL and ONLY the errors. (I'll forgive it, though, if SOME errors screw up its internal state enough that it can't recover, and so puts out an error and terminates without checking further.) I would say that if a compiler puts out a warning or error message by default in response to a VALID piece of code, simply because the compiler is not convinced that I really wanted to say that, then that is a bug in the compiler. The fact the the compiler writer couldn't see any use for some valid construct does not mean there is no valid use for it. The one exception I would be willing to make, is to allow the compiler also to complain about things which are valid within the language, but which are (provably at compile time) impossible on the machine for which it was written. For example, trying to address an odd location as an int, if the hardware requires ints to be even-address aligned. And, as implied at the start, I have no objections to the compiler allowing you to ask for more warnings; but it shouldn't try to ram them down your throat. -- Paul Smee, Univ of Bristol Comp Centre, Bristol BS8 1TW, Tel +44 272 303132 Smee@bristol.ac.uk :-) (..!uunet!ukc!gdr.bath.ac.uk!exspes if you MUST)