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: c.
Subject: Re: avoiding copying arguments by value when calling a function
Date: Mon, 20 Aug 2012 16:00:55 +0200

On 20 Aug 2012, at 15:55, Sergei Steshenko 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.
> 

This is not generally true, it does get copied if your function modifies "bar", 
if "bar" is not modified it is not copied.
c.

reply via email to

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