Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!husc6!ogccse!schaefer From: schaefer@ogccse.ogc.edu (Barton E. Schaefer) Newsgroups: comp.lang.c Subject: Re: mutual reference in structures Message-ID: <2572@ogccse.ogc.edu> Date: 5 May 89 16:21:15 GMT References: <6712@medusa.cs.purdue.edu> <23608@shemp.CS.UCLA.EDU> Reply-To: schaefer@ogccse.UUCP (Barton E. Schaefer) Organization: Oregon Graduate Center, Beaverton, OR Lines: 35 In article <23608@shemp.CS.UCLA.EDU> heather@cs.ucla.edu (Heather Burris) writes: } In article <6712@medusa.cs.purdue.edu> bouma@cs.purdue.EDU (William J. Bouma) writes: } >Please tell me how to get C to accept the following or equivalent code: } > } >typedef union a { } > b_ *pb; } >} a_; } > } >typedef struct b { } > a_ va; } >} b_; } } You cannot do forward references on typedefs. You can, however, } on structure tags. Both DYNIX cc and gcc -ansi -pedantic accept the following without complaint: /* --------------- */ typedef struct b b_; typedef struct a { b_ *bp; } a_; struct b { a_ *ap; }; /* --------------- */ Is there something I'm missing here? -- Bart Schaefer "And if you believe that, you'll believe anything." -- DangerMouse CSNET / Internet schaefer@cse.ogc.edu UUCP ...{sun,tektronix,verdix}!ogccse!schaefer