Addresses of parameters

Paul Svensson pausv at teorix.liu.se
Mon Oct 31 00:46:33 AEST 1988


In article <29781 at think.UUCP> barmar at kulla.think.com.UUCP (Barry Margolin) writes:
>In article <35664 at XAIT.Xerox.COM> g-rh at XAIT.Xerox.COM (Richard Harter) writes:
>>taking the address of a parameter is not a useful kind of thing to do.
>
	[edited]
>the address of that.  I think taking the address of the parameter is
>preferable to making ANOTHER copy of the structure (the first copy has
>to be made during the calling sequence of the function).
>

The OBVIOUS solution is of course to pass the structure by address
in the first place, if you're so afraid of copying it.

Yes, I agree with Barry that taking tha address of a parameter is not
very useful, but that is NOT a good reason for not allowing it.
There are other good reasons, such as making it easier to pass arguments
in registers, for example.  On some machines, like the pdp-10, taking
the address of a register (or a bitfield, but i digress) is easy, on
others its just plain IMPOSSIBLE.  To allow "&" to work on parameters
is essentially the same as to allow it to work on register variables,
it requires the same kind if "fixes" to the compiler. (Unless parameters
are always passed on the stack, an arcane and resource-wasting policy.)

		/Paul



More information about the Comp.lang.c mailing list