help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoiding copying arguments by value when calling a function


From: Michael Goffioul
Subject: Re: avoiding copying arguments by value when calling a function
Date: Mon, 20 Aug 2012 15:00:36 +0100

On Mon, Aug 20, 2012 at 2:55 PM, Sergei Steshenko <address@hidden> wrote:
Hello,

if I understand correctly, if I write a function like this:

function result = foo(bar)
  # function body goes here
endfunction

and if I call the function this way

result = foo(bar);

, the 'bar' argument is copied by value each time 'foo' is called.


To be exact, I think it's only copied if you try to modify the 'bar' argument. If you don't modify it, no copy is made, only an internal reference counter is incremented.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]