Address of array

Wayne Throop throopw at dg_rtp.UUCP
Sun Mar 9 15:02:13 AEST 1986


> I have noticed that different compilers treat the & operator differently
> when it is applied to arrays.  In particular, the UNIX compiler I have
> been using warns against it.  K&R explicitly deny its legality.
> However, the operation seems to me to be perfectly
> reasonable when the desired result is a pointer to the array rather
> than a pointer to the first element of the array.

I agree that C's treatment of array/function/struct addresses is
inconsistant, confusing, and limiting.  In essence a small notational
convenience was traded for a large consistancy headache.  I think the
tradeoff was wrong, but I'm not sure that your proposal would clarify
things.  I'd hesitate to evaluate textually and syntactically identical
constructs differently based on whether an lvalue or an rvalue is needed
in the current context.  This would pile more confusion on an already
dismal situation.
-- 
Wayne Throop at Data General, RTP, NC
<the-known-world>!mcnc!rti-sel!dg_rtp!throopw



More information about the Comp.lang.c mailing list