Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!ut-sally!caip!clyde!cbatt!cbosgd!cbuxc!cbuxb!cbrma!aka From: aka@cbrma.UUCP Newsgroups: net.lang.c Subject: Re: swap() macro Message-ID: <4728@cbrma.UUCP> Date: Mon, 7-Jul-86 14:37:02 EDT Article-I.D.: cbrma.4728 Posted: Mon Jul 7 14:37:02 1986 Date-Received: Wed, 16-Jul-86 20:25:32 EDT References: <1201@brl-smoke.ARPA> <193@stracs.cs.strath.ac.uk> <733@ho95e.UUCP> <1836@brl-smoke.ARPA> <2225@umcp-cs.UUCP> Reply-To: aka@cbrma.UUCP (Andy Kashyap(Andy) x5292) Organization: AT&T-BL, RMAS, Columbus Lines: 50 In article <2225@umcp-cs.UUCP> chris@maryland.UUCP (Chris Torek) writes: >In article <1836@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn >(VLD/VMB) ) writes: >>It may be amusing and/or instructive to contemplate the fact that >>there is no way to write a function that exchanges the contents of >>two variables in a language where parameters are passed "by name". > >How so? It seems rather simple. I have here a C program that effects >call-by-name and does indeed perform a swap: [ ... fragmen x 39 T cd018211043435 cbuxd05279 cbuxd local 40 T cd018211590636 cbuxd06482 cbuxd local 41 T cd018213050437 cbuxa07806 cbuxa local 42 T cd018213051338 cbuxb07820 cbuxb local 43 T cd018213052139 cbuxd07838 cbuxd local 44 T cd018213052740 cblpe07854 cblpe local 45 T cd01