Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 (MC830713); site edai.UUCP
Path: utzoo!watmath!clyde!floyd!vax135!ukc!edcaad!edee!edai!ok
From: ok@edai.UUCP (Richard O'Keefe)
Newsgroups: net.lang.c
Subject: Re: Re: typedef in C
Message-ID: <4068@edai.UUCP>
Date: Wed, 7-Mar-84 20:06:06 EST
Article-I.D.: edai.4068
Posted: Wed Mar  7 20:06:06 1984
Date-Received: Thu, 8-Mar-84 19:21:52 EST
Organization: Art.Intelligence,Edin.Univ.
Lines: 33


     Our news system was pruning old articles, where  an  article  was
deemed  `old'  the  instant it arrived, so I missed the start of this.
If my remark duplicates old information I do apologise.

     The solution to forward pointers in C is essentially the same  as
the  solution  to  forward  pointers  in  Pascal (which does NOT allow
untyped pointers at all, despite the article Re: typedef  in  C).  You
MUST  know  what  a  pointer is pointing to, because there are several
machines around where char* and int* have  DIFFERENT  representations.
What  I  do  is  to  have  somewhere  near  the front of my foo.h file
typedefs like

	typedef struct CELL cellp;

and then put the actual structure or union declarations such as

	typedef struct CELL
	    {
		cellp	next;
		long	junk;
	    } CELL;

anywhere I please.  In PASCAL you would have

	TYPE
	    cellp = ^cell;
	    cell = RECORD
		next: cellp;
		junk: integer;
	    END {cell};

Same difference.  Perfect clarity with no need for hacky #defines.