Path: utzoo!mnetor!uunet!oddjob!hao!husc6!rutgers!mtune!mtunk!io!granjon!edsel!arrow!mhc From: mhc@arrow.UUCP (MH Cox) Newsgroups: comp.lang.c Subject: MSC 5.0 bug or ANSI C feature? Message-ID: <267@arrow.UUCP> Date: 2 Feb 88 01:08:00 GMT Reply-To: mhc@arrow.UUCP (59461-MH Cox) Distribution: comp.lang.c att.c comp.lang.std.c Organization: AT&T Bell Laboratories, Liberty Corner Lines: 44 Keywords: MSC 5.0, ANSI C, name spaces Summary: typedef and field name spaces are the same? I was re-compiling some of my friends code with my shiney new MSC 5.0 compiler, when I received a peculiar fatal syntax error. I won't reproduce all the code exactly, but it went something like this: typedef struct { int some; char stuff; } some_stuff; typedef struct { some_stuff some_stuff; /* same name, no error */ some_stuff *p; } OKAY; typedef struct { some_stuff embedded_struct; some_stuff *some_stuff; /* syntax error! */ } BAD; I realize using a struct member name that's the same as a data type is not a very good idea. But, the above code compiles successfully under MSC 4.0!?! Is this an MSC 5.0 bug or a new ANSI feature? The last time I read the proposed ANSI standard (many moons ago), the above would be syntactically correct. BTW, we compared the code+data sizes of MSC 5.0 vs. MSC 4.0 expecting to see *some* size reduction. Both compilations used the -Os space-over-time optimization and -Gs disable-stack-overflow-check switches (NOTE: the MSC 4.0 compiler defaults to -Os while the MSC 5.0 defaults to -Ot). Including some other optimizations (-Oali) made the MSC 5.0 sizes even larger (as expected). I think I'm going back to 4.0 ... -- Michael H. Cox (201) 580-8622