Sujet : Re: on call by reference
De : alicetrillianosako (at) *nospam* gmail.com (Schol-R-LEA)
Groupes : comp.lang.schemeDate : 20. Mar 2024, 17:07:36
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uteu3o$1hsjh$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
I apologize, I lost my train of thought for part of this:
Schol-R-LEA:
In call-by-reference, what is passed is a pointer or similar reference to the
...to the variable.
In effect, a language in which call-by-reference is used, parameters are implicit pointers to the arguments. So, by comparison to C,
void foo(int bar)
{
bar = 23;
}
in a call-by-reference dialect would be equivalent to
void foo(int* bar)
{
*bar = 23;
}
in standard C.
For obvious reasons, this presents problems with potential side effects and is harmful to modularity, as any change to the parameter variable would silently change the argument. This is why most languages which support call-by-reference at all do so explicitly, with call-by-value being the default.