delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/14/16:30:28

Sender: nate AT cartsys DOT com
Message-ID: <364DF07E.F2E6518F@cartsys.com>
Date: Sat, 14 Nov 1998 13:05:02 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: recursive structures?
References: <364DD66B DOT 3CB7DAD1 AT nospam DOT student DOT tue DOT nl>
Reply-To: djgpp AT delorie DOT com

Wouter Bijlsma wrote:
> 
> Hi,
> 
> How can I define a recursive structure without getting parse errors or
> 'incomplete data type' errors?
> 
> typedef struct {
>                         unsigned     Tag;
>                         Plane        *RootPlane;
>                         BSPNode  *FrontNode,BackNode;
>                         Polygon     *Polygons;
>                     }  BSPNode;
> 
> This does *not* work....

Use the structure tag.  An example (with names that are easier to type
:) :

typedef struct foo_struct {
	int other;
	struct foo_struct *next;
} foo;

Note that `foo' and `struct foo_struct' are now interchangable.  I'm not
sure offhand whether it would be legal to replace `foo_struct' with
plain `foo'.  comp.lang.c would be a good place to ask (would have been
a good place to ask this in the first place...)
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019