- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
By the definitions I'm familiar with, that isn't passing by reference, it's passing by value. PleegWat's explanation is excellent: https://what.thedailywtf.com/t/the-apple-genius/53643/18?u=na5ch
Admin
As mentioned, primitives and objects are different. With primitives there is no reference. With objects, there's a reference, and that's what is passed by value.
Admin
Yeah, that's exactly what I said but with the words in a different arrangement ;)
Admin
OK, just making sure you weren't arguing that "pass reference by value" = "pass by reference". I've kind of lost track of who's saying what in this thread. :-p
Admin
The reference is the value. Nothing you do to that parameter variable itself will change what the caller's view of what it passed in is. The referred-to object might be altered by some operations, but that's by-the-by.
C# has other options available at the language level, making it unnecessary to use ugly things like
Holder
classes there. It also allows marking a value as being directly passable instead of by reference. OTOH, these are substantial increases in complexity for no real increase in expressibility (unless one cares about expressing a very particular ABI, I suppose).Admin
The discussion here has been good and informative examples of trying to teach people about language and variable use. This is especially true of C#.
For this I am going to pass the value of this thread along and reference the value here often.
Admin
Oddly enough, this page is the only one in the whole world which contains that phrase.
Admin
The only one that has been search indexed, anyway.