help-octave
[Top][All Lists]
Advanced

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

Re: IDL's temporary() function


From: Judd Storrs
Subject: Re: IDL's temporary() function
Date: Tue, 22 Apr 2008 13:42:01 -0400


a *= 5;
a += 1;
 
I think this only works when A is already writable without copy in the current scope already. i.e.

function A = test(A)
  A *= 5;
  A += 1;
end

A = test(A);

will allocate a duplicate of A, I think. The idea is that in this case

A = test(temporary(A))

will remove A from the scope of the caller and transport it into the function's scope and mark it as writable so that the multiplication doesn't cause A to be duplicated.

--judd



reply via email to

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