From octave-maintainers-request at bevo dot che dot wisc dot edu Thu Aug 3 00:10:58 2000 Subject: bug in printf in 2.1.31? From: "John W. Eaton" To: Joao Cardoso Cc: octave-maintainers Date: Thu, 3 Aug 2000 00:11:42 -0500 (CDT) On 3-Aug-2000, Joao Cardoso wrote: | I'm not sure if this is 2.1.31 bug... | | octave:1> printf("--%d--\n",[]); | --0-- | octave:2> printf("%d\n"); | 0 | octave:3> printf("%d") | 0ans = 1 | | is it? humm, I think it is. I think it's a bug. Please try the following patch (also checked in to the CVS archive now, so it should show up in the anonymous CVS archive shortly). Thanks, jwe 2000-08-03 John W. Eaton * oct-stream.cc (printf_value_cache::double_value): Also set curr_stat to conversion_error if there are no values at all. Index: oct-stream.cc =================================================================== RCS file: /usr/local/cvsroot/octave/src/oct-stream.cc,v retrieving revision 1.66 diff -u -r1.66 oct-stream.cc --- oct-stream.cc 2000/07/20 19:21:24 1.66 +++ oct-stream.cc 2000/08/03 05:08:37 at @ -2037,7 +2037,10 @@ { double retval = 0.0; - while (val_idx < n_vals) + if (exhausted ()) + curr_state = conversion_error; + + while (! exhausted ()) { if (! data) {