Pointers and Arrays

Guy Harris guy at sun.uucp
Tue Aug 12 04:17:22 AEST 1986


> As for what they SHOULD be....a pointer to an array should be just
> that; indirecting off it should result in an array.  There are good
> reasons this isn't done; I have yet to hear an implementation suggested
> that doesn't have worse flaws than the flaw currently under discussion.

I suspect the implementors of PCC would be interested in hearing those "good
reasons", since PCC *does* implement the type "pointer to array", and if you
dereference something of that type it does yield an array (which gets
converted to a pointer into its first element, along the lines mentioned in
the ANSI C draft).  In fact, they had no choice *but* to implement that
type, since K&R clearly indicates that "pointer to array" is a valid type
(an example is given of a pointer of that type in the C Reference Manual).
It is a nuisance to generate a *value* of that type to assign to a variable
of that type, but that's another matter.

-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.lang.c mailing list