incomplete types (was: Recursive #includes)
Leo de Wit
leo at philmds.UUCP
Tue Mar 14 05:16:08 AEST 1989
In article <9842 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
|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;
};
This declares two structure types, each containing a pointer to the
other one. And I can give more complex examples (a nice one is the
grammar for the Bourne shell, which can be expressed in these type of
recursive data structures: essentially one big struct definition).
Leo.
More information about the Comp.lang.c
mailing list