pcc compiler error

Jeff Dean jeff at aids-unix
Sat Feb 23 10:36:18 AEST 1985


> From: Kevin Szabo <wateng!ksbszabo>
> 
> >	struct xy  {
> >	 	int x;
> >	 	int y;
> >	 } a;
> >	 main()
> >	 {
> >		struct xy *p;
> >		p = &a;
> >	 	if (*p) {
> >			/* compiler error: zzzcode- bad type */
> >		}
> >	}
> >This is not legitimate code (and the compiler should point this out).
> 
> Our BSD 4.2 compiler generates the same error when I just compile it.
> As Marty Shannon says, the code is incorrect. The thing that mystifies
> me is that LINT didn't even peep when I sent the code to it. Thus
> whatever is wrong with CC is also confusing lint, but in a way that
> causes LINT to incorrectly shut up.
> 

It seems to me that the code is legal C (though not necessarily
all that meaningful).  Since C now allows structures to be passed
as parameters, it appears inconsistent to allow something like
"foo(*p)" but not "if(*p)".

Since the code is legal, lint has no reason to complain.  The
error message you received indicated that the back end of your
compiler was not able to generate code.  There are C compilers
that will compile this program.

	jd



More information about the Comp.lang.c mailing list