Xref: utzoo comp.lang.c:25871 comp.std.c:2454 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!mephisto!ncsuvx!mcnc!duke!juliet!khera From: khera@juliet.cs.duke.edu (Vick Khera) Newsgroups: comp.lang.c,comp.std.c Subject: Re: extern int f(); VS int f(); Keywords: Storage Classes, External References Message-ID: <17490@duke.cs.duke.edu> Date: 12 Feb 90 15:54:28 GMT References: <2912@hcx1.SSD.CSD.HARRIS.COM> Sender: news@duke.cs.duke.edu Organization: Duke University CS Dept., Durham, NC 27706 Lines: 29 In article <2912@hcx1.SSD.CSD.HARRIS.COM> brad@SSD.CSD.HARRIS.COM (Brad Appleton) writes: > >Are the following function declarations equivalent? > >(1) extern int foo(); >(2) int foo(); > >Brad Appleton "... and miles to go before I sleep." Under Microsoft C 5.1, the two declarations were just slightly different. If I put "extern int foo(/* some prototype */);" in my header files, then when I compiled the file containing foo() [which #included the header file], I would not get any error messages if the parameter list or function types mismatched. If the header file contained "int foo(/* some prototype */);" then the I would get the proper messages. In both cases, other files (not containing the definition of foo() ) would compile the same, generating the appropriate messages. A friend of mine tells me that he worked with a compiler recently that would complain about a function having a duplicate declaration if the extern form was not used when the file containing the definition was compiled. v. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vick Khera Department of Computer Science ARPA: khera@cs.duke.edu Duke University UUCP: ..!{mcnc,decvax}!duke!khera Durham, NC 27706