Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Why static forward references Message-ID: <4919@mimsy.UUCP> Date: Mon, 5-Jan-87 20:45:58 EST Article-I.D.: mimsy.4919 Posted: Mon Jan 5 20:45:58 1987 Date-Received: Tue, 6-Jan-87 00:45:12 EST References: <6927@ki4pv.UUCP> <4870@mimsy.UUCP> <5478@brl-smoke.ARPA> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 33 Doug Gwyn quotes something that is misleading, and seems to have mislead: >>In article <6927@ki4pv.UUCP> tanner@ki4pv.UUCP (Tanner Andrews) writes: >>>extern char *blunge(); /* declare blunge */ >>>char *gork() { return(blunge(69)); } /* use blunge */ >>>static char *blunge(arg) int arg; { /* body of blunge here */ } >In article <4870@mimsy.UUCP> I wrote: >>But if the ANSI standard mandates that the code author must use >>`extern' or `static' on forward declarations, these compiler writers >>can save themselves the trouble of doing things right, or of fixing >>their linkers. And that appears to be the entire motivation. In article <5478@brl-smoke.ARPA> gwyn@brl-smoke.ARPA (Doug Gwyn ) writes: >I don't think that is the issue at all. The question is, WHICH >"blunge" should be used in the above example? I think the static one should be used. But we were trying to _eliminate_ the `extern' from the first declaration. The above example is one we would like to eradicate. >According to the "declare things correctly before you use them" >school, the external blunge() should be used, not the internal >one. But this is not in fact what happens with any of the compilers I have used. (Not that I have used many C compilers.) I also happen to think it is a bad idea to force one to encode the visibility of a function in its type declarations as well as in its definition, although I can see how others would feel otherwise. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: seismo!mimsy!chris ARPA/CSNet: chris@mimsy.umd.edu