array names and pointers
Wayne Throop
throopw at sheol.UUCP
Fri Oct 12 07:55:25 AEST 1990
> I need a lesson in the semantic differences between passing the name of
> an array and passing a pointer to the type of that array. In other
> words, how does the following usage differ? [..code omitted..]
The above brings four questions to mind.
1) What is meant by "passing the name of an array"? Now this
pretty clearly means "using the name of an array object as an
actual parameter", but why not just say "passing an array"?
Saying "passing the name of" makes me think of by-name binding, or
of something else exotic. (I know, the phrase "passing an array"
is misleading in C, because of the conversion of arrays to
addresses in value contexts. But even so...)
2) What is meant by "passing a pointer to the type of that array"?
It may well mean "passing the address of an object of the type of
elements of that array", but I'm even less sure of this one.
Mainly, just what a "pointer to the type of an array" might be
is obscure... perhaps this is inside a compiler or an interpreter?
As in "pointer to name of", "pointer to type of" makes me think
of something more exotic than was probably intended.
3) How does the following usage differ from what? Or maybe this
means "how do these two usages differ"? I'm so confused.
and finally
4) I wonder if the FAQ list needs a "glossary" section, so that if
the above usages are well known, I can learn them, or if they are
not, others can adopt better-known usages. I know the FAQ already
is careful to describe terms related to null pointers... perhaps
it ought to recommend other usages as well.
Just a thought. Fry me gently if I'm just being silly.
( And in case anyone wondered, "using the name of an array object as
an actual parameter" is, in fact, a subcase of "passing the address
of an object of the type of elements of that array". That is, the
former is one way of accomplishing the latter. )
--
Wayne Throop <backbone>!mcnc!rti!sheol!throopw or sheol!throopw at rti.rti.org
More information about the Comp.lang.c
mailing list