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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no 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-04 12:17:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!not-for-mail From: "David Thompson" Newsgroups: comp.lang.ada References: <3E11C888.1060102@cogeco.ca> Subject: Re: Another ammunition X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: Date: Sat, 04 Jan 2003 20:17:31 GMT NNTP-Posting-Host: 12.89.129.149 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1041711451 12.89.129.149 (Sat, 04 Jan 2003 20:17:31 GMT) NNTP-Posting-Date: Sat, 04 Jan 2003 20:17:31 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:32543 Date: 2003-01-04T20:17:31+00:00 List-Id: 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.) According to all C standards before C99 (K&R and C89) it *is* legal and so can't conformingly be an error. 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, 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