Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!sdrc!thor!scjones From: scjones@thor.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: initializing static mutually referencing structures Message-ID: <186@thor.UUCP> Date: 21 Sep 90 13:16:09 GMT References: <1287@granjon.UUCP> Distribution: usa Organization: SDRC, Cincinnati Lines: 23 In article <1287@granjon.UUCP>, jhpb@granjon.UUCP (Joseph H. Buehler) writes: > I have some structures that refer to each other, that I want to be > static. The compiler doesn't like the following because it doesn't know > what y is when it's initializing x: > > static struct xtag x = {&y}; > static struct ytag y = {&x}; > > Does ANSI C have any way to do this? static struct ytag y; /* tentative definition */ static struct xtag x = {&y}; static struct ytag y = {&x}; /* actual definition */ > For now, I had to drop the static and put an extern at the top of the file Which is what you'll have to do for most non-ANSI compilers. ---- Larry Jones UUCP: uunet!sdrc!thor!scjones SDRC scjones@thor.UUCP 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 I'm not a vegetarian! I'm a dessertarian. -- Calvin