[comp.lang.c] MSC 5.0 bug or ANSI C feature?

mhc@arrow.UUCP (MH Cox) (02/02/88)

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