"array" vs. "&array" ? (not again! :-O )

Walter Murray walter at hpclwjm.HP.COM
Fri Jan 12 04:48:20 AEST 1990


Gary L. Randolph writes:

> If this part of the answer does not seem reasonable, take it up with
> Harbison and Steele's second edition.  The statement was taken verbatim
> from page 273, section 11.6.4.

[Quoting H&S-2:  "The address operator & applied to an array yields
"pointer to array of T" or "pointer to pointer to T".]

This statement by Harbison and Steele contradicts ANSI C.  They
should not have added the part about "pointer to pointer to T".
ANSI 3.3.3.2.

> And, if that is not enough, see page 200 A7.1 of K&R2 (or read below).

> If the type of an expression or subexpression is "array of T," for
> some type T, then the value of the expression is a pointer to the
> first object in the array, and the type of the expression is altered
> to "pointer to T".

> K&R2 does not say that the above is true only for a few special cases.

Read the very next sentence:  "This conversion does not take place if
the expression is the operand of the unary & operator ... ."
This is in ANSI 3.2.2.1.

Walter Murray
----------



More information about the Comp.lang.c mailing list