octave-maintainers
[Top][All Lists]
Advanced

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

Re: Question about short circuit operators


From: Jordi Gutiérrez Hermoso
Subject: Re: Question about short circuit operators
Date: Fri, 25 Feb 2011 12:13:00 -0600

2011/2/25 John W. Eaton <address@hidden>:
> On 25-Feb-2011, Jordi Gutiérrez Hermoso wrote:
>
> | I think the Matlab warning about short circuit operators is warranted.
> | Matlab's behaviour is extremely weird and in effect makes it
> | impossible to not short circuit in conditions. Octave clearly
> | separates & and && plus | and || for short and not short-circuiting
> | operations. Since this affects semantics, if you're writing code that
> | relies on these weird semantics you should be warned about it. If you
> | don't like the warning, put
> |
> |      warning off Octave:possible-matlab-short-circuit-operator
> |
> | in your .octaverc
> |
> | I just noticed that the warning_ids function didn't list this ID.
>
> I don't object if you want to add more IDs to the warning_ids
> function, but I'm not sure that it makes sense for us to worry too
> much about trying to list all possible warning IDs there since anyone
> can create their own warning with an ID.

I pushed it:

It would be nice to be able to generate the conents of warning_ids.m
automatically, but since it was easy to add one more description, I
just went ahead and did it.

     http://hg.savannah.gnu.org/hgweb/octave/rev/d1466d956d17

I was thinking of disabling the warning if
do_braindead_shortcircuit_evaluation was enabled, since presumably
people who turn on that option know what they're doing and don't need
to be reminded. Are there other similar conditions that enable or
disable warnings?

- Jordi G. H.


reply via email to

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