[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warning: suggest parenthesis around assignment used as truth value
From: |
John W. Eaton |
Subject: |
Re: warning: suggest parenthesis around assignment used as truth value |
Date: |
Fri, 13 Mar 2009 03:38:53 -0400 |
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
Re: warning: suggest parenthesis around assignment used as truth value, Ben Abbott, 2009/03/13