Addresses of parameters (was Re: Portability of passing/operating ...)

Henry Spencer henry at utzoo.uucp
Fri Oct 28 02:28:15 AEST 1988


In article <35620 at XAIT.Xerox.COM> g-rh at XAIT.Xerox.COM (Richard Harter) writes:
>... The technical reason is that a calling sequence
>parameter need not have an address...
>... Arguments in C are copies of the parameters passed.  The address
>(if it exists) is the address of the copy; it is not, so to speak, an
>address of a real object.  The general point is that calling sequence
>parameters are a different breed of cat from other variables...

Sorry, not so.  C parameters are defined, and have been defined for a
long time, to be local variables that are initialized to the values
supplied by the caller.  They are specifically *not* a different breed
of cat from other local variables.  They are real objects; if the &
operator is used on one (legally, i.e. in the absence of "register"),
the parameter must have an address.  This admittedly makes extra work
for implementations that normally pass parameters in registers, but
that's part of the job.  A compiler that botches this is broken.
-- 
The dream *IS* alive...         |    Henry Spencer at U of Toronto Zoology
but not at NASA.                |uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list