Re: strange case of "if ((a & b))"
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers@lists.postgresql.org
Date: 2021-05-10T06:32:01Z
Lists: 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
Commits
-
Clean up more code using "(expr) ? true : false"
- 68f7c4b57a27 15.0 landed
-
Clean up some code using "(expr) ? true : false"
- fd0625c7a9c6 15.0 landed