From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,17e99293e94a7e6f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-06 09:43:08 PST Message-ID: <3E19BF66.2050506@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Another ammunition References: <3E11C888.1060102@cogeco.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Date: Mon, 06 Jan 2003 12:39:50 -0500 NNTP-Posting-Host: 198.96.47.195 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1041874792 198.96.47.195 (Mon, 06 Jan 2003 12:39:52 EST) NNTP-Posting-Date: Mon, 06 Jan 2003 12:39:52 EST Organization: Bell Sympatico Path: archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Xref: archiver1.google.com comp.lang.ada:32627 Date: 2003-01-06T12:39:50-05:00 List-Id: David Thompson wrote: > Warren W. Gay VE3WWG wrote : >>Jean-Pierre Rosen wrote: >> >>>"Eric G. Miller" a �crit dans le message news: >> > IpfQ9.4953 > .... > >>>>You're right, but I'm sure gcc could have immediately diagnosed the >>>>problem had you turned up the warnings ("conflicting types for...", >>> > "previous > >>>>declaration of ..."). >>> >>>Warnings were on, he just overlooked them.... > > Could have (and did) *IF* the same declaration is visible at > all relevant locations, typically by #include'ing the same .h file. > If you just write out a wrong declaration of foo in bar.c, gcc can't > catch it (though a good lint can). Also, if you mistakenly #include > a wrong .h file (such as from a wrong subtree) gcc can't catch it, > although this is unlikely in simple student projects. > (A C implementation *could* legally and practially do > the kinds of whole-program or at least cross-unit checks > Ada requires and GNAT does, but they don't, not even gcc.) > .... >>Things may be different now, but I once had a long email discussion >>with one of the folks about whether a missing return "type" should >>be a warning or not (it should actually be an error). At the time, >>you had to specify a compile option to make a declaration like: >> >>foo() { ... } >> >>return a warning. ... > > (That's a definition, not just a declaration. > /*int*/ foo () ; is a typical "external" declaration.) Sigh, yes, everyone knows this. Even pure undefiled Ada programmers know this, I expect. ;-) > According to all C standards before C99 (K&R and C89) it *is* > legal and so can't conformingly be an error. Fine, but it should be a warning. > With C99 it is a > required diagnostic and could well be an error, but won't because > implementors don't want to break vast masses of existing legal > and supported code. I agree it should be a warning, Agreed. It _should_ be at least a warning. > but whether > it's on by default doesn't matter much to me, since I always end up > with some mechanism (makefile, script, envvar) for setting flags > anyway, and if this needs an entry in there it's no real trouble. > > -- > - David.Thompson 1 now at worldnet.att.net The point is, is that a lot of other projects and even team members fail to include the support for this "warning". If it were on by default, there would be uncounted number of hours saved each year by programmers who instead spend the time debugging a problem related to this issue. I've seen this time and again, even though my team members know about it. It is not enough to say "it is not an issue because I do this...". It is an issue, that could be fixed once and for all. Even a warning doesn't guarantee that it will be noticed and fixed -- but it greatly increases the odds! However, the best solution of all is to use Ada instead, and only rely on C like an assembly level layer, when required ;-) -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg