Bonkers

Daniel Barlow dan at coruskate.net
Sun May 13 12:47:47 BST 2007


Andy Wardley wrote:
> muppet wrote:
>> The only real way to pass an array by value is to wrap it up in 
>> something else that you pass by value. 
> 
> I think you're missing the obvious.
> 
> You can pass a reference to a string/array using '&' and then
> de-reference it again at the other end with '*'.

Which is, pretty much, the exact opposite of passing it by value (one 
might even term it "pass by reference").  If the called function 
modifies the string you've passed in this way, it's changing your string 
not its own copy.

Mind you, the meaning of "pass by value" *does* vary widely depending on 
exactly which religion you subscribe to ...

http://c2.com/cgi/wiki?JavaPassesByValue
http://c2.com/cgi/wiki?JavaDoesntPassByValue


-dan


More information about the london.pm mailing list