forward declared structures

John Gilmore gnu at sun.uucp
Thu Aug 9 15:19:26 AEST 1984


Another way I've used forward declared (actually undeclared) structures
is when I have a large structure full of "global" variables, many of
which are pointers to other structures.  If the compiler required a
definition of every structure which I declare a pointer to, I'd have
to include every include file in every program -- and edit every program
each time I added another struct * to the global structure.  The way
it is now, (4.2BSD cc, Unisoft V7, MIT cc68, etc) I only need to declare
a structure if I'm going to dereference the pointer (use it to point
to a member) in this module.  If I don't touch it, or if I just assign
it or pass it as a parameter, the compiler doesn't need to know what's
inside the struct it points to.

I'd hate to lose this feature.  Does ANSI C break it?



More information about the Comp.lang.c mailing list