M
mitchellpal
i am really having a hard time trying to differentiate the
two..........i mean.....anyone got a better idea how each occurs?
two..........i mean.....anyone got a better idea how each occurs?
i am really having a hard time trying to differentiate the
two..........i mean.....anyone got a better idea how each occurs?
i am really having a hard time trying to differentiate the
two..........i mean.....anyone got a better idea how each occurs?
i am really having a hard time trying to differentiate the
two..........i mean.....anyone got a better idea how each occurs?
i am really having a hard time trying to differentiate the
two..........i mean.....anyone got a better idea how each occurs?
who did?boy you mastered my email
Please quote some context so others can understand what you're saying............but there is this passing of
parameters by reference.....sorry i mistook.... i mean like when you
use pointers... what you got now?
Lew said:-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
My two cents (may be devalued by others in the newsgroup )
With "call by value", the caller passes the /value/ of the source data
to the target. If the target changes the data it receives, it only
changes a copy of the value, not the original data.
With "call by reference", the caller makes the source data directly
available to the target. Both source and target refer to the data in the
same way, and changes that the target makes to the data will be
reflected in the original data.
Note the difference: in the "call by reference" example above, both
target() and caller() shared a common definition of the data (int). In
the /emulated/ "call by reference", caller() defines the data as int,
and target() defines it's access as pointer. Not true "call by
reference", but does the same thing.
[snip]Lew said:-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
My two cents (may be devalued by others in the newsgroup )
Your explanation is great, but I'd still use "pass" rather than "call",
as parameters are /passed/ to functions, and functions themselves are
/called/. For the latter, "by reference" or "by value" have no meaning.
Vladimir S. Oka said:Lew Pitcher wrote: [...]Note the difference: in the "call by reference" example above, both
target() and caller() shared a common definition of the data (int). In
the /emulated/ "call by reference", caller() defines the data as int,
and target() defines it's access as pointer. Not true "call by
reference", but does the same thing.
Your explanation is great, but I'd still use "pass" rather than
"call", as parameters are /passed/ to functions, and functions
themselves are /called/. For the latter, "by reference" or "by value"
have no meaning.
> "Call by foo" (for foo = "value", "reference", or "name") was a common
> term in the past (1960s or so?).
> When the term was used, I think that
> most or all languages passed *all* parameters using the same method.
[...]Dik T. Winter said:Even earlier, I think.
Wrong. Algol 60 was a language where the kind of passing (by value or
by name) was specified for each parameter. (Actually it was by name
unless the callee explicitly specified it was by value.)
Roughly: a call f(X) to a function defined by f(a ofType T) is
call-by-reference (better would have been "pass by value", but we'll
Pedantic, and only since I'm already replying: when the _parameter_let that ... through) if updating the argument a inside f results in
(immediately) updating the variable X. It's call-by-value if changing
the value of a doesn't change the value of X.
C doesn't have call-by-reference. C++ does (when the argument is
defined to have a reference type) as does Pascal (when the argument
is a VAR parameter).
Dave said:IrrTYM 'pass by reference' here.
Yes.
Pedantic, and only since I'm already replying: when the _parameter_
has reference resp. VAR type. The corresponding _argument_ must be an
lvalue resp. variable, i.e. not just a value.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.