Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/12/84; site desint.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!trwrb!desint!geoff From: geoff@desint.UUCP (Geoff Kuenning) Newsgroups: net.lang.c Subject: Re: structure references in header files Message-ID: <148@desint.UUCP> Date: Sat, 14-Dec-85 01:36:09 EST Article-I.D.: desint.148 Posted: Sat Dec 14 01:36:09 1985 Date-Received: Mon, 16-Dec-85 05:32:43 EST References: <547@brl-tgr.ARPA> <2528@umcp-cs.UUCP> Reply-To: geoff@desint.UUCP (Geoff Kuenning) Organization: SAH Consulting, Manhattan Beach, CA Lines: 24 People who want to write maximally portable should also note the following technique, so that they can avoid it: typedef struct foo *ZAP; typedef struct bar *ZOW; struct foo { ZOW *zowie; }; struct bar { ZAP zapped; }; Since pcc (and, I believe, the original pdp-11 compiler) treats typedefs as macros, this works on those compilers. However, it breaks lint, and it breaks on many compilers that actually treat typedefs as types, since the structs are undefined at the time of the typedef statement. -- Geoff Kuenning {hplabs,ihnp4}!trwrb!desint!geoff