address of function

Norman Diamond diamond at diamond.csl.sony.junet
Wed Jun 14 14:06:20 AEST 1989


in answer to someone's question:

>> ... 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;
>since "&this" is a pointer to "this", and "this" is an array of 100
>"int"s, so "&this" is a pointer to an array of 100 "int"s (not a pointer
>to a single "int"

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)

Could one also do it in this way?
	int	this[100], *that = (int *)&this;
or maybe in this way?
	int	this[100], *that = (void *)&this;

i.e.:  when a cast implies an assignment to an anonymous temporary, it
becomes a non-lvalue -- ok; but does it also become a non-constant?

--
Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.co.jp at relay.cs.net)
 The above opinions are my own.  However, if you see this at Waterloo, Stanford,
 or Anterior, then their administrators must have approved of these opinions.



More information about the Comp.lang.c mailing list