PCC, lint bug

Guy Harris guy at sun.uucp
Tue Sep 3 18:41:43 AEST 1985


> 	int x[STUFF][THING] ;	/* the name 'x' is a pointer to an int */

WRONG WRONG WRONG

The name "x" is a pointer to an array of THING "int"s, not a pointer to an
"int".

(See article in net.lang.{c,f77} for a discussion of the way arrays work in
C.  They aren't equivalent to pointers.  The name of an array is equivalent
to a pointer to its first member, but if the members of an array are
themselves arrays a pointer to the first member of such an array is not
equivalent to a pointer to the first member of the first member of that
array.)

The type checking in PCC/lint is incorrect; it takes two types and keeps
stripping one layer of pointer/array off both of them until 1) one type is a
scalar type and the other isn't, which is an error or 2) both types are
scalar types, in which case the scalar types are compared.  "scalar"
includes "structure", etc. here...

	Guy Harris



More information about the Comp.unix.wizards mailing list