Recursive #includes

Karl Heuer karl at haddock.ima.isc.com
Tue Mar 7 05:56:40 AEST 1989


In article <7488 at june.cs.washington.edu> ka at june.cs.washington.edu (Kenneth Almquist) writes:
>I've been told that incomplete types cannot be used in function
>prototypes.  For example,
>	void f(struct s *);
>	struct s { ... };
>	void f(struct s *p) { ... }
>is illegal ...

Yes it is illegal, but due to a scoping problem, not a restriction against
incomplete types.  Adding the empty declaration `struct s;' at the top should
cause it to become legal.  (I just tested this with gcc.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list