address of function

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jun 17 07:37:44 AEST 1989


In article <10361 at socslgw.csl.sony.JUNET> diamond at csl.sony.junet (Norman Diamond) writes:
>>> ... and does ANSI permit the following ?
>>>	int	this[100], *that = &this;
>In article <1817 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
>>No.  It does permit
>>	int	this[100], (*that)[100] = &this;
>Oh I'm so glad ANSI is standardizing existing practices instead of
>inventing new RESTRICTIONS.  This rule won't break much existing,
>FORMERLY UNBROKEN source code, now will it?  :-S  (sarcasm)

The (proposed) Standard does not in this regard (&array_name) break
existing correct code.  The base document, K&R1 Appendix A, quite
clearly constrains & to be applied to an lvalue and states that an
array identifier is not an lvalue expression.  The Standard has
actually extended the language in this regard, not restricted it.

The fact that some old compilers were sloppy and permitted an & to
be applied to an array identifier (usually as a no-op) is irrelevant
since it was not something a programmer could legitimately rely on.



More information about the Comp.lang.c mailing list