incomplete types (was: Recursive #includes)

Wayne A. Throop throopw at agarn.dg.com
Thu Mar 16 04:51:29 AEST 1989


> leo at philmds.UUCP (Leo de Wit)
>| gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>)
>|There is nothing inherently "bad" about incomplete types, especially
>|incomplete structure declarations.  In fact they are essential for
>|declaring structures that contain pointers to each other.
> How essential that is? Consider:
>     struct egg {
>          struct hen {
>               struct egg *eggp;
>          } *henp;
>     };

Ok.  I've considered it.  The type "struct egg" is incomplete
at the point it is used, namely in the line

                struct egg *eggp;

So I'd say Leo hasn't come up with an example where mutually
referential structures can be defined without resorting to
incomplete types.

As far as I can see, it's still essential.

--
All the system's paths must be topologically and circularly
interrelated for conceptually definitive, locally transformable,
polyhedronal understanding to be attained in our spontaneous -- ergo,
most economical -- geodesiccally structured thoughts.
                              --- R. Buckminster Fuller
--
Wayne Throop      <the-known-world>!mcnc!rti!xyzzy!throopw



More information about the Comp.lang.c mailing list