|
From: | Paul Eggert |
Subject: | Re: FYI: [PATCH] utimecmp: avoid new GCC 7 warning from -Wbool-operation |
Date: | Wed, 5 Oct 2016 09:51:43 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 10/05/2016 09:17 AM, Jim Meyering wrote:
* lib/utimecmp.c (utimecmp): Do not apply "~" to a boolean.
Hah! And just Monday I was telling students how C operations like binary +, unary and binary -, and ~ can produce non-boolean outputs when given boolean inputs. That's a feature, not a bug.
While I'm ranting, another thing that bothers me is that gcc -Wall doesn't know that == is both commutative and associative on booleans: it complains about "a==b==c" even when all arguments are boolean so that inserting parentheses cannot reduce ambiguity. It's times like this that I think GCC's '-Wall' option should really be called '-Wnanny'.
[Prev in Thread] | Current Thread | [Next in Thread] |