forward declared structures

Mike Rubenstein mmr at utmbvax.UUCP
Fri Aug 3 13:36:38 AEST 1984


>	A structure or union specifier of the second form, that is, one of
>	    struct identifier { struct-decl-list }
>	    union identifier { struct-decl-list }
>	declares the identifier to be the structure tag (or union tag) of
>       the structure specified by the list.  A SUBSEQUENT declaration may
>	then use the third form of specifier, one of
>	    struct identifier
>	    union identifier
>	Structure tags allow definition of self-referential structures; . . .
>	a structure or union may contain a pointer to an instance of itself.

>Capitalization of SUBSEQUENT is mine.  Implicitly within this "subsequent"
>means subsequent to the "struct identifier {" rather than subsequent to the
>entire declaration, otherwise structures containing pointers to themselves
>would not be allowed.

On the other hand, a few months ago I was working with a compiler that
handles this "correctly."  Unfortunately, I wanted to declare something
like

	struct foo     { struct bar *b };
	struct bar     { struct foo *f };

Frustrating.
-- 

	Mike Rubenstein, OACB, UT Medical Branch, Galveston TX 77550



More information about the Comp.lang.c mailing list