PCC compiler bug and odd solution

Kenneth Almquist ka at hou3c.UUCP
Sat Mar 3 02:08:20 AEST 1984


A piece of code which caused the compiler to exhibit the same behavior
was posted to net.lang.c a couple of weeks ago.  The code looked like:

	struct s {
		int x ;
	}

	subr(p, q) struct s *p, *q ; {
		*q = *p ;
	}

Because the semicolon after the declaration of "s" was omitted, the routine
"subr" is declared to be a routine returning a structure s rather than a
routine returning int.  The missing semicolon would have been caught by
the compiler if "subr" had been declared to be of type "void".
					Kenneth Almquist



More information about the Comp.unix mailing list