From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5D541385800D; Wed, 31 Aug 2022 23:46:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D541385800D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661989604; bh=DaYtNPwbOSIQgtFnsMyzk2ORF6nUeRimaAPS8lSqaI0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RcFd2/vnPOKlmdhrsuP7ogTWR/xCE4CCkL+9H1bHIsD82Y39acORj8n34MSsCQTwa rYKYotmOjUPHt8VmaZIPP+fQQU0jK3ztr7LFJHs3IL+38w8SKAykfgAf/tJV3e17iI ihoASpgdYFSfzLaPSe4SrNyDJDJVSw/qr+RpRt3M= From: "f.heckenbach@fh-soft.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106774] warning about comparison to true/false Date: Wed, 31 Aug 2022 23:46:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: f.heckenbach@fh-soft.de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106774 --- Comment #6 from Frank Heckenbach --- > --- Comment #4 from Eric Gallager --- > (In reply to Richard Biener from comment #3) > > that's more coding style though? >=20 > Yeah I personally prefer the more explicit way of writing it with both op= erands > myself It's not really about operands, but the whole operation is redundant: "mybool =3D=3D true" is exactly equivalent to just "mybool". So it's similar to a cast to the original type which GCC can also warn about (-Wuseless-cast). Some other existing warnings (-Wredundant-decls, -Wredundant-move) also seem to warn about things that are no potential problems, just redundant. Of course, all of this can be considered a matter of style, that's why warnings can be selected by options. (As I said, I assume it would not be enabled by -Wall, and I don't mind whether or not it's enabled by -Wextra.)=