style

Tom Stockfisch tps at chem.ucsd.edu
Wed Apr 27 09:13:27 AEST 1988


In article <7770 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <13115 at brl-adm.ARPA> jfjr at mitre-bedford.arpa (Freedman) writes:
>> Now, as a former Pascal programmer I like the typedef method
>>MUCH better than the tag method...
>Typedef was added to C after struct tags...Sometimes it is easier to
>use tags, though, as in
>	struct my_tag {
>		struct my_tag *link;
>		data_t data;
>	};


In this case you can use

	typedef struct LIST {
		struct LIST	*link;
		data_t		data;
	}	LIST;

since tags and typedefs are in different overload classes.
This usage is not strange looking if you think of the
initial "struct LIST" as meaning "BEGIN LIST DECLARATION"
and the final "LIST;" as "END LIST DECLARATION".
-- 

|| Tom Stockfisch, UCSD Chemistry	tps at chem.ucsd.edu



More information about the Comp.lang.c mailing list