typedef in c (recursive structs)

Tim Maroney tim at unc.UUCP
Fri Mar 9 04:42:39 AEST 1984


I agree that it is too difficult to create recursive structs with a typedef
in C.  That extra tag that you have to create is a pain:

(1) when you're writing C yourself (a phenomenon called "straining
programmer creativity")

(2) when you're automatically generating C code (for example, for an IDL
interface -- you want the generator to be as simple as possible)

(3) when you're reading someone else's C code (having two different
constructions that mean exactly the same thing is always a bitch)

It would be much better if the C compiler would defer creating an error in a
typedef for an unknown identifier used as a type, until the types declared
in the typedef are known, and perform a fixup then.  Unfortunately, this
would be fairly difficuly to implement in pcc, since it treats identifiers
and typedef names as separate sorts of tokens.  Still, that should not be
the sort of consideration that shapes a language.
--
Tim Maroney, University of North Carolina at Chapel Hill
mcnc!unc!tim (USENET), tim.unc at csnet-relay (ARPA)

The opinions in this article are entirely my own, and should not be
construed as representing the policy of UNC or the opinions of my employers,
nor of the race of wombats or any other burrowing quadruped.



More information about the Comp.lang.c mailing list