From bug-octave-request at bevo dot che dot wisc dot edu Fri Feb 22 20:45:38 2002 Subject: Re: strrep fails when define_all_return_values=1 From: "John W. Eaton" To: Paul Kienzle Cc: Kwasniak Miroslaw , bug-octave@bevo.che.wisc.edu Date: Fri, 22 Feb 2002 20:45:34 -0600 On 20-Feb-2002, Paul Kienzle wrote: | The following patch works for me in my limited tests. It just | moves the check for undefined values until after the function | has been evaluated. Seems OK. The intent of having define_all_return_values was to ensure that all returned values were defined when a function returns, not that they would be predefined to some value before a function is called. I made your change, but moved it inside the following if (ret_list) block, like this: Index: ov-usr-fcn.cc =================================================================== RCS file: /usr/local/cvsroot/octave/src/ov-usr-fcn.cc,v retrieving revision 1.23 diff -c -r1.23 ov-usr-fcn.cc *** ov-usr-fcn.cc 30 Nov 2000 00:34:40 -0000 1.23 --- ov-usr-fcn.cc 23 Feb 2002 02:40:23 -0000 *************** *** 411,417 **** // Copy return values out. if (ret_list) ! retval = ret_list->convert_to_const_vector (vr_list); else if (Vreturn_last_computed_value) retval(0) = last_computed_value; } --- 403,419 ---- // Copy return values out. if (ret_list) ! { ! if (Vdefine_all_return_values) ! { ! octave_value tmp = builtin_any_variable ("default_return_value"); ! ! if (tmp.is_defined ()) ! ret_list->initialize_undefined_elements (tmp); ! } ! ! retval = ret_list->convert_to_const_vector (vr_list); ! } else if (Vreturn_last_computed_value) retval(0) = last_computed_value; } Thanks, jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------