pointers to arrays and the '&' operator
Gordon Cross
crossgl at ingr.com
Wed Feb 15 01:00:27 AEST 1989
Allright, the recent discussion regarding pointers to arrays in C reminds
me of something that I consider to be a major deficiency of the language.
I could not find any explicit reference to this in the standard (admittedly
I have an old copy) but Harbison and Steele do mention that it is not legal.
Since I am allowed to declare something that has type "pointer to an array
of...", then why am I not permitted to apply the '&' (address of) operator
directly to an array?? Yes, before you say it, I know that the array name
is converted to a pointer in expressions but I also know that the usual
conversions do not apply to the '&' operator. It seems perfectly reasonable
to expect that the expression &E where E is an array should result in a
constant of type "pointer to array"!! What thoughts do the rest of you have
on this??? Do more recent versions of the standard address (no pun intended)
this concern??
P.S. The same argument can be said for pointers to functions and &E where
E is the name of a function...
--
Gordon Cross UUCP: uunet!ingr!crossgl "all opinions are
111 Westminister Way INTERNET: crossgl at ingr.com mine and not those
Madison, AL 35758 MA BELL: (205) 772-7842 of my employer."
More information about the Comp.lang.c
mailing list