Re: On Call By Value
- From: Eric Sosman <Eric.Sosman@xxxxxxx>
- Date: Wed, 22 Apr 2009 09:59:04 -0400
Hamish Reid wrote:
In article <_9adnR3mCPWS4nPUnZ2dnUVZ8u2dnZ2d@xxxxxx>,
Richard Heathfield <rjh@xxxxxxxxxxxxxxx> wrote:
Hamish Reid said:
The recent thread here on pass (or call) by value vs pass (orAnd in case anyone doesn't recognise the quote, it's from K&R2, p27. Apart from some minor punctuation differences (quoting style and a hyphen), it appears to me to be verbatim.
call) by reference has been particularly surreal for someone who
first encountered C when it had no longs and was working under
Edition 6 (and where its strict call by value was a real asset),
but never mind. I know it's not normative, and not going to end
any arguments, but I accidentally ran across this quote today in
an old book on C I once read almost religiously:
"One aspect of C functions may be unfamiliar to programmers who
are used to some other languages, particularly Fortran. In C, all
function arguments are passed 'by value'. This means that the
called function is given the values of its arguments in temporary
variables rather than the originals. This leads to some different
properties than are seen with 'call by reference' languages like
Fortran or with var parameters in Pascal, in which the called
routine has access to the original argument, not a local copy."
(all typos and spelling mistakes mine...).
Yes, not normative, but surely also not without some sort of
authority....
Yeah, it's a shame I can't find my old original K&R. [...]
K&R has text very similar to that in K&R II. Section 1.8
"Arguments - Call by Value" on page 24 begins (typos mine):
One aspect of C functions may be unfamiliar to programmers
who are used to other languages, particularly Fortran and
PL/I. In C, all function arguments are passed "by value."
This means that the called function is given the values of
its arguments in temporary variables (actually on a stack)
rather than their addresses. This leads to some different
properties than are seen with "call by reference" languages
like Fortran and PL/I, in which the called routine is handed
the address of the argument, not its value.
The changes can mostly be summarized as a backing away from detailing
the specifics of how an implementation produces the call-by-value
outcome, focusing instead on the outcome itself.
--
Eric.Sosman@xxxxxxx
.
- Follow-Ups:
- Re: On Call By Value
- From: Hamish Reid
- Re: On Call By Value
- References:
- On Call By Value
- From: Hamish Reid
- Re: On Call By Value
- From: Richard Heathfield
- Re: On Call By Value
- From: Hamish Reid
- On Call By Value
- Prev by Date: Re: when does operator promotion happen? Is it expensive?
- Next by Date: Re: Pointers
- Previous by thread: Re: On Call By Value
- Next by thread: Re: On Call By Value
- Index(es):
Relevant Pages
|