Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!iscuva!frigg!carlp From: carlp@frigg.iscs.com (Carl Paukstis) Newsgroups: comp.lang.c Subject: Re: Struct definition in MS-C Keywords: pointer, linked list, Microsoft C Message-ID: <2600@iscuva.ISCS.COM> Date: 21 Aug 89 20:16:17 GMT References: Sender: news@iscuva.ISCS.COM Reply-To: carlp@frig.UUCP (Carl Paukstis) Organization: ISC Systems Corporation, Spokane WA Lines: 33 In article shuang@caip.rutgers.edu (Shuang Chen) writes: >I am trying to use struct to implement a linked list with Microsoft C. >typedef struct { > ... > node *next; > } node; > >Actually I tried to use > >struct node { > ... > struct node *next; > }; >as it is with standard C, but this doesn't work with MS-C. Chen doesn't mention which version of MSC - both of the above constructs work just fine with v5.10, even in "W3" (bitchy) warning mode they (properly) don't generate any messages whatsoever. However, I can see how MS could have implemented a version which choked on the first construct but compiled the second OK. I'm certainly no compiler guru, but it seems to me that the second example gives the compiler some needed information sooner. Would things improve if we changed the first example to start with typedef struct node {... ? -- Carl Paukstis "I'm the NRA" | DOMAIN: carlp@iscuva.ISCS.COM | UUCP: ...uunet!iscuva!carlp | GEnie: carlp BIX: carlp I speak for myself, not my employer. | Ma Bell: +1 509 927 5439