Swap by name

Ben Cranston zben at umd5.UUCP
Tue Jul 8 08:37:23 AEST 1986


In article <1964 at brl-smoke.ARPA> rbj at icst-cmr.ARPA (Root Boy Jim) writes:
> I was thinking of the caller squirrelling away the value in a temporary
> location, passing it by reference (thus allowing modification by the
> callee) and then copying the result to the real variable.

In article <1060 at umd5.UUCP> zben at umd5.UUCP (Ben Cranston) replies:
> Of course the difference between this and real call-by-name comes when 
> the subroutine has an alternate access to the global in question - perhaps
> because of scoping rules, or access to a pointer-to-it or something.

In article <2293 at umcp-cs.UUCP> chris at maryland.UUCP (Chris Torek) cautions:
> Careful, Ben: this was under a section about call by value-result,
> and it does accomplish that quite handily.

Er, yeah.  Another difference between call-by-name and value-result comes
when the actual is subscripted like a[i] and different array indices can
be selected on each reference to the formal (assuming i modified).  This
would have been a better example than the one I actually gave.   

No criticism of you or Root Boy was meant, I was only adding information.
Your point that I should have reviewed the entire discussion before posting
is well taken.
-- 
                    umd5.UUCP    <= {seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben
Ben Cranston zben @ umd2.UMD.EDU    Kingdom of Merryland Sperrows 1100/92
                    umd2.BITNET     "via HASP with RSCS"



More information about the Comp.lang.c mailing list