Xref: utzoo comp.lang.c:25816 comp.std.c:2446 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!mailrus!uflorida!novavax!hcx1!brad From: brad@SSD.CSD.HARRIS.COM (Brad Appleton) Newsgroups: comp.lang.c,comp.std.c Subject: extern int f(); VS int f(); Summary: When is "extern int f();" different from "int f();" Keywords: Storage Classes, External References Message-ID: <2912@hcx1.SSD.CSD.HARRIS.COM> Date: 9 Feb 90 16:10:21 GMT Sender: news@hcx1.SSD.CSD.HARRIS.COM Organization: Harris Computer Systems, Fort Lauderdale, FL Lines: 41 References: Are the following function declarations equivalent? (1) extern int foo(); (2) int foo(); I was just asked this question and I thought I knew a precise answer but I find that I am a little fuzzy on this one! I thought (2) is like a "forward" declaration in Pascal and that the only difference between these two is that If I use (2) then I may define the function "foo" (give it a body) later on in the same file. Is this right? I have looked in K&R (2e) and Harbison-Steele to try to find the answer (as well as a few other texts) but nothing I have read seems to state the difference between these two in precise terms (IMHO at least)! When would I use (1) and not (2) (and vice-versa)? Is this dependent on the Compiler Vendor? Is the answer different between ANSI-C and non-ANSI C? I am somewhat new to the net and would also appreciate some constructive feedback on whether this issue is worthy/appropriate for this newsgroup! (any responses that are strictly feedback and not an answer to my question stated in the subject line should probably reply by e-mail). TIA (Thanks in Advance). -- Brad Appleton "... and miles to go before I sleep." +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ | Harris Corporation | brad@csd.harris.com | | Computer Systems Division, M/S 161 | {uunet,novavax}!hcx2!brad | | 2101 West Cypress Creek Road | | | Fort Lauderdale, FL 33309 USA | Phone: (305) 973-5007 | +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ Brad Appleton "... and miles to go before I sleep." +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ | Harris Corporation | brad@csd.harris.com | | Computer Systems Division, M/S 161 | {uunet,novavax}!hcx2!brad | | 2101 West Cypress Creek Road | | | Fort Lauderdale, FL 33309 USA | Phone: (305) 973-5007 | +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+