Bug in cc

Dave Sherman dave at utcsrgv.UUCP
Tue Dec 6 07:11:35 AEST 1983


Is that a problem? I treat it as a compiler feature I take advantage of.

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

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

Both types can usefully refer to x,y, and flag, but only the
"foo" type has ->sp as well. I've never had a problem with this,
and hope new compilers aren't going to stop it.

Yes, I know you're all going to tell me I shouldn't do it,
and there are better ways of doing it, and it's dangerous,
and...  But I happen to like it.

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.


Dave Sherman
Toronto

-- 
 {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave



More information about the Comp.lang.c mailing list