Re: Using ref
- From: "Hilton" <nospam@xxxxxxxxxx>
- Date: Thu, 3 Jul 2008 03:33:13 -0700
Peter Duniho wrote:
Hilton wrote:
What example is it that you are saying uses "ldloca.s"? Are you
comparing this to managed code? If not, how can that be "same as C"?
In any case, the "ldloca.s" instruction is used when you pass by
reference, yes. But that's only when you use the "ref" or "out" keyword.
My point is that the C# call "method (ref x)" is defined by
you/Jon/community as being pass by reference, yet the C call "method (&x)"
is defined by you/Jon/community as being pass by value - they're doing
EXACTLY the same thing. Both simply take the address of x and pass it
along. Does a prettier syntax changes the entire concept? And if
Microsoft has used "&" instead of "ref" in its definition of the C#
language, would that now mean that the C# call "method (&x)" was now pass by
value???
Pete, really, I don't want to spend more of your time or my time on this.
In my mind (which I agree probably doesn't fit the pure definition of the
pass-by definitions), if I pass a reference or pointer to my chunk of data,
I'm passing by reference (the focus being on the data, not the actual
parameter). I think millions of other people think that way too since
pass-by-reference has been taught for decades when discussing C, but
apparently that capability never existed.
Hilton
.
- Follow-Ups:
- Re: Using ref
- From: Ben Voigt [C++ MVP]
- Re: Using ref
- From: Pavel Minaev
- Re: Using ref
- From: Peter Duniho
- Re: Using ref
- From: Jon Skeet [C# MVP]
- Re: Using ref
- From: Marc Gravell
- Re: Using ref
- References:
- Using ref
- From: Arjen
- Re: Using ref
- From: Steve Harclerode
- Re: Using ref
- From: Jon Skeet [C# MVP]
- Re: Using ref
- From: Steve Harclerode
- Re: Using ref
- From: Jon Skeet [C# MVP]
- Re: Using ref
- From: Hilton
- Re: Using ref
- From: Peter Duniho
- Using ref
- Prev by Date: Re: Using ref
- Next by Date: Re: Web Browser Control -- View HTTPS web contents as web folder
- Previous by thread: Re: Using ref
- Next by thread: Re: Using ref
- Index(es):