[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warnings in ProjectCenter and GNUstep detect
From: |
David Chisnall |
Subject: |
Re: warnings in ProjectCenter and GNUstep detect |
Date: |
Thu, 7 Apr 2011 15:47:30 +0100 |
On 7 Apr 2011, at 15:42, Riccardo Mottola wrote:
> Hi,
>> PCMiscPrefs.m:194:15: warning: equality comparison with extraneous
>> parentheses
>> [-Wparentheses]
>> if ((sender == debuggerField))
>> ~~~~~~~^~~~~~~~~~~~~~~~
>> PCMiscPrefs.m:194:15: note: use '=' to turn this equality comparison into an
>> assignment
>
> Could it be that GCC has the suggestion of the double parentheses instead ? I
> remember something about the double () being suggested by gcc but I don't
> remember when. I put it in when it complains.
Nope, GCC recommends parentheses for this:
if (sender = debuggerField)
It will say that you probably mean ==, and if you don't then you should use an
extra set of parentheses. Clang is warning you here because the GCC warning
means that double parentheses are used to protect a=b type conditionals, and
this isn't one but could be a typo if you meant one.
Changing this to:
if (sender == debuggerField)
Or:
if ((sender = debuggerField))
Will make both compilers happy. The first form is almost certainly what was
meant, in this case, although I can't be completely sure without seeing the
surrounding code.
David
-- Sent from my Cray X1