Bug in cc

guy at rlgvax.UUCP guy at rlgvax.UUCP
Wed Dec 7 14:54:41 AEST 1983


<please don't trash me>

	struct foo
	{
		int x,y;
		char flag;
		struct something *sp;
	};

	struct bar
	{
		int x,y;
		char flag;
	};

	.
	.
	.

	Note that the compiler will (and should) give you an error if
	you try and put "x", "y" or "flag" into a different place in
	the second structure than it appears in the first.

The language was changed as of System III so that the compiler doesn't
(and shouldn't) complain if "x", "y", or "flag" either appears in a different
place or has a different type (and since 4.xBSD comes with the System III
VAX-11 PCC, it applies there also).  This behavior is more sensible than
the "sugared assembler" previous behavior - structure member names are not
just symbolic names for byte offsets.  There is no reason why structure
names shouldn't be local to the structure - admittedly, putting in the
unique tags that everybody did before this compiler change may make it
a bit easier to identify what kind of a structure "c_foo" is a member
of.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.lang.c mailing list