forward references in typedefs

David Goodenough dg at lakart.UUCP
Fri Jul 28 02:07:07 AEST 1989


henry at utzoo.uucp (Henry Spencer) sez:
> The latter.  The language permits forward references with structure tags
> (specifically, "struct foo *x;" when foo has not yet been seen) but not
> the equivalent with typedefs.  That's just the way it is.
> 
> (Oh, you want to know *why*?  Basically, because typedefs are a royal pain
> to parse at the best of times, and forward references just complicate the
> issue hopelessly.

Also, have you considered the following:

typedef	a *b;

typedef b *a;

There, now your compiler is _REALLY_ confused :-)
-- 
	dg at lakart.UUCP - David Goodenough		+---+
						IHS	| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp at xait.xerox.com		  	  +---+



More information about the Comp.lang.c mailing list