| From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Peter Smith <smithpb2250(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: strange case of "if ((a & b))" |
| Date: | 2021-08-19 07:34:35 |
| Message-ID: | A316C1ED-E5CB-4849-8D24-DE19D33D563E@yesql.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On 19 Aug 2021, at 05:08, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Peter Smith <smithpb2250(at)gmail(dot)com> writes:
>> On Thu, Aug 19, 2021 at 4:29 AM Justin Pryzby <pryzby(at)telsasoft(dot)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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2021-08-19 07:50:48 | Re: Skipping logical replication transactions on subscriber side |
| Previous Message | Greg Nancarrow | 2021-08-19 07:29:50 | Re: Skipping logical replication transactions on subscriber side |