By Reference

L

Lit

Hi,

when passing by reference through multiple layers or AppDomains or outProc,
servers or external domains over the web.

Is it truly by Reference or at some boundaries things are marshaled and
passed by Value?


Lets say we are passing by Ref from server A to server B to server C etc...

What is happening?


Thank you,

Lit
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Lit said:
Hi,

when passing by reference through multiple layers or AppDomains or outProc,
servers or external domains over the web.

Is it truly by Reference or at some boundaries things are marshaled and
passed by Value?


Lets say we are passing by Ref from server A to server B to server C etc...

What is happening?

Obviously you are not sending a pointer to the variable, as that would
be useless on a different computer. The value of the variable is sent
and a new value is returned, which is stored in the variable.

Passing by reference actually doesn't have to use a pointer in any
situation at all. The value of the variable is only guaranteed to be
updated when the method returns, the compiler can implement this by
sending the value of the variable and updating the variable on return
whenever that is more efficient.
 
L

Lit

Hi Goran,

To be clear, so based on some compiler logic it may or may not pass a
pointer at all?
Does that include passing some reference to an Object also? or anything.

Thanks for your input.

Lit
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Lit said:
To be clear, so based on some compiler logic it may or may not pass a
pointer at all?

Correct. It's only defined what the result is, not how it's implemented.
Does that include passing some reference to an Object also? or anything.

Passing a reference is completely different from passing a variable by
reference. If you write code to pass a reference, a reference will be
passed.
 
L

Lit

Goran,

Excellent, Thank you.

Do you have a C, C++ background or -beyond?

Thanks again,

Lit
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Lit said:
Goran,

Excellent, Thank you.

Do you have a C, C++ background or -beyond?

Thanks again,

Lit

A have a background in Atari Basic, Compis Pascal, 6502 machine code,
Comal, Pascal, C, Fortran, Cobol, GFA Basic, 68000 Assembler, Turbo
Pascal, 80x86 Assembler, C++, VBScript, VB6, Javascript, C#.

:)
 

Ask a Question

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.

Ask a Question

Top