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

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: strange case of "if ((a & b))"
Дата
Msg-id A316C1ED-E5CB-4849-8D24-DE19D33D563E@yesql.se
обсуждение исходный текст
Ответ на Re: strange case of "if ((a & b))"  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> On 19 Aug 2021, at 05:08, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Peter Smith <smithpb2250@gmail.com> writes:
>> On Thu, Aug 19, 2021 at 4:29 AM Justin Pryzby <pryzby@telsasoft.com> wrote:
>>> -       state->oneCol = (origTupdesc->natts == 1) ? true : false;
>>> +       state->oneCol = origTupdesc->natts == 1;
>
> FWIW, I am definitely not a fan of removing the parentheses in this
> context, because readers might wonder if you meant an "a = b = 1"
> multiple-assignment, or even misread it as that and be confused.
> So I'd prefer
>
>          state->oneCol = (origTupdesc->natts == 1);

+1, the parenthesis makes it a lot more readable IMO.

--
Daniel Gustafsson        https://vmware.com/




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Nancarrow
Дата:
Сообщение: Re: Skipping logical replication transactions on subscriber side
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: Skipping logical replication transactions on subscriber side