warning: suggest parenthesis around assignment used as truth value

Ben Abbott bpabbott at mac.com
Fri Mar 13 09:12:19 CDT 2009


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.
>
> Cheers,
> Rob

ok, I'm convinced that you are correct. It doesn't appears  more  
likely that the error is from gcc.

Ben



More information about the Octave-maintainers mailing list