Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix-wizards Subject: Re: Re: PCC, lint bug Message-ID: <2754@sun.uucp> Date: Tue, 3-Sep-85 04:41:43 EDT Article-I.D.: sun.2754 Posted: Tue Sep 3 04:41:43 1985 Date-Received: Thu, 5-Sep-85 01:04:24 EDT References: <1152@brl-tgr.ARPA> Organization: Sun Microsystems, Inc. Lines: 21 > 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