Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!ucbcad!ucbvax!ovaltine!cartan!brahms.Berkeley.EDU!ballou From: ballou@brahms.Berkeley.EDU.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: Problems with MSC 5.0 Message-ID: <1427@cartan.Berkeley.EDU> Date: Wed, 25-Nov-87 04:20:26 EST Article-I.D.: cartan.1427 Posted: Wed Nov 25 04:20:26 1987 Date-Received: Sat, 28-Nov-87 14:29:01 EST References: <754@pilchuck.Data-IO.COM> <1610047@hpcvlo.HP.COM> <1203@lznv.ATT.COM> Sender: usenet@cartan.Berkeley.EDU Reply-To: ballou@brahms.Berkeley.EDU.UUCP (Kenneth R. Ballou) Organization: Math Dept. UCB Lines: 32 In article <1203@lznv.ATT.COM> psc@lznv.ATT.COM (Paul S. R. Chisholm) writes: >In article <1610047@hpcvlo.HP.COM>, jason@hpcvlo.HP.COM (Jason Su) writes: >> /* Here's another irritating bug that compiled(!) w/o errors on MSC 4.0. */ >> typedef int map; >> >> typedef struct { >> int *map; /* <-- This is the error line */ >> } my_struct; > >K&R, p. 200: "Declarations whose 'storage class' is typedef do not >define storage, but instead DEFINE IDENTIFIERS WHICH CAN BE USED LATER >AS IF THEY WERE TYPE KEYWORDS . . ." [emphasis mine] > >The identifier "map" is effectively a reserved keyword from the time >its typedef is complete through the end of the compiled module. MSC >4.0 was incorrect in accepting this code in the first place. I suspect >that most C compilers that support typedef will reject it. Er, well, you are correct in the strict sense of K&R. However, it is my impression that Microsoft is moving their C compiler towards compliance with the draft ANSI standard. Now, unless I am misreading the standard, the members of a struct reside in a name space unique to that struct; moreover, this name space is disjoint from that in which typedef identifiers reside. Hence, if the goal is to follow the ANSI standard, it would seem MSC 5.0 is in error. Kenneth R. Ballou ARPA: ballou@brahms.berkeley.edu Department of Mathematics UUCP: ...!ucbvax!brahms!ballou University of California Berkeley, California 94720