Recursive #includes

Kenneth Almquist ka at june.cs.washington.edu
Mon Mar 6 21:12:10 AEST 1989


In article <3804 at xyzzy.UUCP>, throopw at agarn.dg.com (Wayne A. Throop) writes:
> But note that each module only needs to be able to declare a pointer
> to the other's type.  In C, this can be done using incompleted types.
> (See section 3.5.2.3 of pANS, and especially footnote 48 of that
> section.)

I've been told that incomplete types cannot be used in function
prototypes.  For example,

	void f(struct s *);

	struct s {
		int i;
	};

	void f(struct s *p) {
		...
	}

is illegal because s is not defined when the function prototype for
f is processed.  If so, this makes Wayne's suggestion pretty useless.
Have I been misinformed?
				Kenneth Almquist



More information about the Comp.lang.c mailing list