octave-maintainers
[Top][All Lists]
Advanced

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

user function return values


From: Jaroslav Hajek
Subject: user function return values
Date: Tue, 15 Sep 2009 17:34:23 +0200

hi,

Today I discovered that user functions called via feval would always
return an octave_value_list of length equal to the number of declared
parameters, padded by undefined values for undefined outputs. I'm not
100% sure this was a bug, but I found it very surprising and quite
unexpected for extern apps embedding octave; for instance, I was
getting surprising bugs in pytave for very simple and correct calls.
So I took the liberty to change it:
http://hg.savannah.gnu.org/hgweb/octave/rev/080e11f1b0c1

If nargout is >= 1, return first nargout values from the output list,
incl. undefined values.
If nargout == 0, return the 1st value from the list if it is defined,
otherwise return 0.

The main point is to prevent undefined values being returned in the
list, unless the function actually didn't define the requested number
of output values.

make check passes for me, but chances still are that this may break
something, so if you see a gotcha, please let me know.

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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