Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!yale!mintaka!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: initializing static mutually referencing structures Summary: `extern' is not sufficient Message-ID: <18180@haddock.ima.isc.com> Date: 24 Sep 90 23:48:51 GMT References: <1287@granjon.UUCP> <1990Sep21.230632.19238@csc.canberra.edu.au> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Distribution: usa Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 11 In article <1990Sep21.230632.19238@csc.canberra.edu.au> eyal@echo.canberra.edu.au (Eyal Lebedinsky) writes: >ANSI asks you to add a line: `extern struct ytag y;' before the first >definition. Note that 'extern' does not mean that y is 'external to this >file' but that 'it is defined elsewhere'. True, but it also means that the symbol is expected to have external linkage, unless it's already been declared otherwise (see 3.1.2). You have to use the `static' keyword instead. (Note that this is how to do it in ANSI C. There is no sure way to do it in Classic C.) Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint