From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: strange case of "if ((a & b))"
Date: Mon, 10 May 2021 02:32:01 -0400
Message-ID: <577206.1620628321@sss.pgh.pa.us> (raw)
In-Reply-To: <YJjSQWcx1xno9vyB@paquier.xyz>
References: <20210428182936.GE27406@telsasoft.com>
<2896014.1619635209@sss.pgh.pa.us>
<YJjSQWcx1xno9vyB@paquier.xyz>
Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Apr 28, 2021 at 02:40:09PM -0400, Tom Lane wrote:
>> Agreed, but shouldn't we just drop the excess parens rather than
>> doubling down on useless notation?
> Using a notation like ((a & b) != 0) to enforce a boolean check after
> the bitwise operation is the usual notation I've preferred, FWIW. Do
> you mean something different here?
Yeah --- the "!= 0" is pointless in the context of an if-test.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, pryzby@telsasoft.com, pgsql-hackers@lists.postgresql.org
Subject: Re: strange case of "if ((a & b))"
In-Reply-To: <577206.1620628321@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox