Re: strange case of "if ((a & b))"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: strange case of "if ((a & b))"
Date: 2021-05-10 06:32:01
Message-ID: 577206.1620628321@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message tanghy.fnst@fujitsu.com 2021-05-10 06:36:19 RE: Remove "FROM" in "DELETE FROM" when using tab-completion
Previous Message Tom Lane 2021-05-10 06:30:23 Re: Inaccurate error message when set fdw batch_size to 0