octave-maintainers
[Top][All Lists]
Advanced

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

Re: stupid Matlab-style short-circuit behavior for | and &


From: John W. Eaton
Subject: Re: stupid Matlab-style short-circuit behavior for | and &
Date: Thu, 7 Oct 2010 14:03:48 -0400

On  7-Oct-2010, Rik wrote:

| A quick run on all the .m files shows 398 occurrences,

Looking at the output of

  find scripts -name '*.m' | xargs perl find_orand.pl

I see many cases where the results are insiide character strings or
not in IF or WHILE conditions, so those cases don't count.  It might
be easiest to enable a parser warning about the cases that could
possibly be affected.  Writing a perl script for that seems harder to
me than just adding a warning in the
tree_binary_expression::mark_braindead_shortcircuit function.

| In addition, the script should be run an the
| .cc files to check for uses in the %!test sections.

| #!/usr/bin/perl -n
| 
| next if /^\s*#/;   # skip comments

The test sections always begin with %! so I think this script already
checks the tests and I don't see any instances of & or | being used in
IF or WHILE conditions in the output I generated with the command
above.  Adding a warning in the parser and enabling it for a test run
should confirm that.

jwe



reply via email to

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