&array
Howard Johnson
howard at cyb-eng.UUCP
Sat Oct 27 11:34:51 AEST 1984
My first impression of the construct foo(&1) was that it should be
classified as a feature which is a nonportable extension to C.
But then I thought for a moment and it occurred to me that &1 can be
handled by the compiler in a way quite similar to handling foo("hello") !
What happens is that foo("hello") causes the compiler to allocate and
initialize a character array and use it's (constant) address as a parameter.
Likewise, foo(&1) could cause the compiler to allocate a unique cell
(an int), initialized with the value 1, and pass *that* (constant) address
as a parameter. Note that this does *not* imply that array declarations
(e.g. bar[10]) get space allocated for a pointer to that array's address.
Howard Johnson ..!ut-sally!cyb-eng!howard
P.S.: I can just see a program similar to xstr used to put all instances
of &1 definitions into the same place, so that every &1 points to the same
place... :-)
More information about the Comp.lang.c
mailing list