Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!gatech!hubcap!ncrcae!ncrlnk!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: pointers to arrays Message-ID: <1044@auspex.UUCP> Date: 18 Feb 89 09:56:53 GMT References: <19784@uflorida.cis.ufl.EDU> <13171@steinmetz.ge.com> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 24 >It looks to me as though given: > int flimflam[20]; >that &flimflam has type address of int. Not in dpANS C; it has type "pointer to array of 20 'int's". It has that type in C as implemented by most PCC-based implementations. >I maintain that if flimflam is an array [20] of int, then &flimflam >is "address of array [20] of int." And the dpANS (and probably the pANS, of which I don't yet have a copy) agrees with you. >I couldn't see X3J11 supporting a rewrite of arrays, but I don't believe >that defining &array to return pointer to array would hurt existing >programs, they get warnings in most cases anyway. X3J11 probably didn't believe it either, which is why "&array" is supposed to have the type "pointer to array...". Basically, "array-valued expressions" are converted to "pointer to first element of array" in most, but not all, contexts; "operand of 'sizeof'" and "operand of unary &" are contexts in which this conversion isn't done. Check your (d)pANS copy again; it's there (at least it's in the May 13, 1988 draft, and I'd be surprised as hell if it disappeared subsequently).