Re: strange case of "if ((a & b))" - Mailing list pgsql-hackers

From Tom Lane
Subject Re: strange case of "if ((a & b))"
Date
Msg-id 577206.1620628321@sss.pgh.pa.us
Whole thread Raw
In response to strange case of "if ((a & b))"  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Inaccurate error message when set fdw batch_size to 0
Next
From: "tanghy.fnst@fujitsu.com"
Date:
Subject: RE: Remove "FROM" in "DELETE FROM" when using tab-completion