typedef in c

ldl at genix.UUCP ldl at genix.UUCP
Wed Feb 29 09:11:32 AEST 1984


	typedef struct
	{
		newtyp *member;
	}       newtyp;

	I finally had to do something along these lines
	
	typedef struct stupid
	{
		struct stupid  *member;
	}       newtyp;

					Jeremy Sanders
		{philabs|pegasus|esquire|cucard}!aecom!{sanders|jsanders}

Unfortunately, just knowing that something is a pointer isn't good enough
for C.  It insists on knowing 'pointer to what'. (Pascal does allows for
the case that knowing that something is a pointer is enough. Something for
the new standard?).  I'm sure I'll be flamed for this, but, what I do in a
case like this is:

	#define	NEWTYP	struct newtyp
	typedef NEWTYP
	{
		NEWTYP *member;
	}       newtyp;

It does exactly what you 'resorted' to, but is a bit easier (for me) to read.
-- 
Spoken: Larry Landis
USnail: 5201 Sooner Trail  NW
        Albuquerque, NM 87120
MaBell: (505)-898-9666
  UUCP: {ucbvax,gatech,parsec}!unmvax!genix!ldl



More information about the Comp.lang.c mailing list