This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Warn for dangerous use of omitted middle operand in ?:
- From: Andi Kleen <andi at firstfloor dot org>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: Andi Kleen <andi at firstfloor dot org>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Jun 2010 14:28:02 +0200
- Subject: Re: [PATCH] Warn for dangerous use of omitted middle operand in ?:
- References: <20100531081916.GA20230@basil.fritz.box> <4C2349F9.3030700@gnu.org>
> As a follow up, if the else-branch is a comparison too you could warn as
>
> "the omitted middle operand in ?: will always be %<true%>, "
> "suggest using || instead of ?:"
That would assume the omitted operand wasn't a mistake.
At least in the case that prompted me originally to add this
warning it was a mistake and was supposed to be a different value.
-Andi
--
ak@linux.intel.com -- Speaking for myself only.