Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: Initialization Message-ID: <5249:Oct421:05:1090@kramden.acf.nyu.edu> Date: 4 Oct 90 21:05:10 GMT References: <464@spader.UUCP> Organization: IR Lines: 26 In article <464@spader.UUCP> lab@spader.UUCP (Lars Berntzon) writes: > My problem is that i want to initialize two types of struct variables with > the address of the opposit struct. > static a = {&b, data ...}; > static b = {&a, other data...}; Deja vu... I quote from <18201:Sep2203:25:3190@kramden.acf.nyu.edu>: : > > static struct xtag x = {&y}; : > > static struct ytag y = {&x}; : : A different approach should work under any C compiler, though it may not : be implemented efficiently. It also has the usual syntactic problems of : macros. : : static struct { struct xtag x; struct ytag y; } : shmoe = { &(shmoe.y), &(shmoe.x) } ; : #define x (shmoe.x) : #define y (shmoe.y) : : Caveat: This is untested. But the idea is useful to remember. I think the conclusion of the discussion was that there's no (other) portable solution. ---Dan