octave-maintainers
[Top][All Lists]
Advanced

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

repeated var in output argument


From: Dupuis
Subject: repeated var in output argument
Date: Tue, 11 Dec 2007 12:12:33 -0800 (PST)

Hello,
I recently tracked down a bug in a program I wrote due to a typo in the
names of output variables, so one of them was repeated twice. Basically
something as
[U, S, S]=svd(randn(3,3)) # correct: [U, S, V] = ...
but, due to the length of the line, I didn't notice until close inspection.
 
Now, a funny thing: octave is not bug-to-bug compatible with matlab with
regard to this behaviour.
Octave 2.9.19 : print S a first time with values only on the main diagonal,
and a second time as a unitary matrix.
Matlab 6.1 : print S the two times as a unitary matrix
Afterwards, in both case, S contains the unitary matrix, the diagonal matrix
is lost.

Would it be possible to issue a warning if some variable is repeated in the
output arguments of a function call ? This is a stupid typo, but as
problematic as
if (x=1) # instead of (x==1)

In the first place, this is a problem in the way the function call is
written. I would find interesting to add a feature to detect such
overwriting of variables.

Best regards

Pascal Dupuis
-- 
View this message in context: 
http://www.nabble.com/repeated-var-in-output-argument-tp14282340p14282340.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



reply via email to

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