Pointers and Arrays

karl at haddock karl at haddock
Sat Aug 16 09:40:00 AEST 1986


dg_rtp!throopw (Wayne Throop) writes:
>What I was objecting to was elevating this common bug [interpreting &a as
>&a[0]] to a "standard feature".  I still think it would be wrong to do so.
>If it means anything (and currently it does *NOT*), (&array) should indicate
>the address of the whole array, not the address of its first element.

As I mentioned before, X3J11 seems to have accepted the "correct" meaning.
In the case of the other "optional ampersand", if f is a function locator,
then "&f" and "f" are equivalent.  I personally think the first is more
meaningful (language purity and all that; "f" should denote the function as a
whole, even if you can't do anything with it other than "&" or "()"), but I
don't use it because lint prefers the second.  I also detest the usage of
"pf()" for "(*pf)()", but X3J11 has blessed this as well.  (In fact, they
defined "()" to *always* operate on a function *pointer* (possibly obtained
from the implied "&" on a function locator), so now the first form is more
"correct"!)

Karl W. Z. Heuer (ihnp4!ima!haddock!karl), The Walking Lint



More information about the Comp.lang.c mailing list