Bug in the if test

John W. Eaton jwe at bevo.che.wisc.edu
Tue Aug 19 13:09:49 CDT 2008


On 18-Aug-2008, Jaroslav Hajek wrote:

| On Tue, Aug 12, 2008 at 11:07 AM, Zdenek Wagner
| <wagner at hroch486.icpf.cas.cz> wrote:
| > To: bug at octave.org
| > Cc: zdenek.wagner at gmail.com
| > Subject: Bug in the if test
| >
| > Bug report for Octave 3.0.1 configured for i386-redhat-linux-gnu
| >
| > Description:
| > -----------
| >
| >  * I have the following code in order to make the same program work in several
| >    versions of Octave:
| >
| > if exist("save_precision") == 5
| >  oldprec = save_precision(newprec);
| > else
| >  oldprec = save_precision;
| >  save_precision = newprec;
| > endif
| >
| > Yet Octave emits warning that save_precision is no longer a builtin variable
| > although exist("save_precision") does return 5.
| >
| > Repeat-By:
| > ---------
| >
| > The code is inside a function written by me. The bug occurs both when called
| > interactivelly and when invoked from a script started by
| > octave -qH script.m
| >
| > Fix:
| > ---
| >
| 
| Currently, the check is made at parse time. The attached patch
| postpones it until first actual execution of the statement (but only
| warns once).

I applied this change to my sources.

Thanks,

jwe


More information about the Bug-octave mailing list