forward declared structures

Johnson Howard Reed howard at byucsb.UUCP
Mon Aug 6 18:14:30 AEST 1984


The problem with:
	struct foo { struct bar *b; };
	struct bar { struct foo *f; };
is that it allows a procedure to appear between them (at the global level).
If this is rewritten as:
	struct foo { struct bar { struct foo *f; } *b; };
then any "forward reference" refers to a partially-declared struct/union
and makes it easier for the compiler to detect such typos as:
	struct foo { struct bar { struct foo f; } *b; };

Howard Johnson
harpo!utah-cs!beesvax!byucsa!byucsb!howard



More information about the Comp.lang.c mailing list