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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Smith <smithpb2250(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: strange case of "if ((a & b))"
Date: 2021-09-07 05:59:58
Message-ID: YTb/3iLjBg0Te6hI@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 05, 2021 at 07:11:10PM -0500, Justin Pryzby wrote:
> I revised the patch based on these comments. I think my ternary patch already
> excluded the cases that test something other than a boolean.

In 0002, everything is a boolean expression except for
SpGistPageStoresNulls() and GistPageIsLeaf(). So that's a good
cleanup overall.

- pathnode->parallel_aware = parallel_workers > 0 ? true : false;
+ pathnode->parallel_aware = parallel_workers > 0;
I also prefer that we keep the parenthesis for such things. That's
more readable and easier to reason about.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2021-09-07 06:00:01 Re: stat() vs ERROR_DELETE_PENDING, round N + 1
Previous Message Dilip Kumar 2021-09-07 05:58:24 Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()