initializing static mutually referencing structures

Karl Heuer karl at haddock.ima.isc.com
Tue Sep 25 09:48:51 AEST 1990


In article <1990Sep21.230632.19238 at csc.canberra.edu.au> eyal at 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 at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list