warning: suggest parenthesis around assignment used as truth value
Ben Abbott
bpabbott at mac.com
Fri Mar 13 07:33:44 CDT 2009
On Mar 13, 2009, at 3:38 PM, John W. Eaton wrote:
> On 13-Mar-2009, Ben Abbott wrote:
>
> | On Mar 13, 2009, at 9:40 AM, Rob Mahurin wrote:
> |
> | > On Mar 12, 2009, at 9:08 PM, Ben Abbott wrote:
> | >> Can someone explain what this warning is intended to imply?
> | >>
> | >> warning: suggest parenthesis around assignment used as truth
> value
> | >
> | > This is a gcc warning? The idiom
> | > if (x=1) { ... }
> | > is legal and useful but often a typo for
> | > if (x==1) { ... }
> | > Extra parentheses
> | > if ((x=1)) { ... }
> | > apparently suppress the warning.
>
> The intent of the Octave warning is the same as the GCC warning. In
> what case is it emitted incorrectly?
>
> | Your examples do give me some additional context for what is imlied.
> | Unfortunately, I've searched my sources and don't see such an
> instance
> | in my if/elseif statments. Further when I convert warnings to errors
> | ("warning error"), I get what looks like a parser error.
>
> Using "warning error" will likely generate a lot of unwanted errors
> from code that is distributed with Octave. We should probably limit
> these warnings to code that is not part of Octave itself.
>
> jwe
I'm still getting the original warning. Can anyone recommend what I
might do to determine the respective file and line number which is
responsible?
Ben
More information about the Octave-maintainers
mailing list