This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] regrename.c: Fix a warning.
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Richard dot Earnshaw at arm dot com, Kazu Hirata <kazu at cs dot umass dot edu>, gcc-patches at gcc dot gnu dot org, rearnsha at arm dot com
- Date: Thu, 15 Jan 2004 09:28:16 +0000
- Subject: Re: [patch] regrename.c: Fix a warning.
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> On Wed, Jan 14, 2004 at 06:01:32PM +0000, Richard Earnshaw wrote:
> > Hmm, the assignment was always inside the conditional, but wasn't on it's
> > own before -- perhaps that's a weakness in our warning heuristic.
>
> Nope. The extra () heuristic,
>
> if ((var = val))
>
> is explicitly intended to suppress the warning. Indeed, that's the
> fix that the warning suggests. You removed the extra parenthesis.
>
Yep. I can't say I much like that idiom. I'd much rather see
if ((var = val) != 0)
making the comparison explicit.
But that's personal preference.
R.