Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: gcc bug (possibly) Message-ID: <9786@smoke.BRL.MIL> Date: 5 Mar 89 00:56:30 GMT References: <9201@orstcs.CS.ORST.EDU> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 17 In article <9201@orstcs.CS.ORST.EDU> budd@mist.cs.orst.edu (Tim Budd) writes: >Unless I am seriously mistaken in my understanding of prototypes, our version >of gcc produces an error in what I believe is a correct program. >extern int foo ( short ); >int foo(x) >short x; >{ ; } >I get a message that the argument doesn't match the prototype. GCC is correct to complain about this usage. That's because the parameter (formal argument) doesn't match the prototype. By using an old-style function definition, you've required that `x' be passed as an int, then converted to short upon entry to the function. The prototype says that it's passed as a short in the first place. Those two functions interfaces are not in general conformable.