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

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: strange case of "if ((a & b))"
Date: 2021-06-25 02:31:11
Message-ID: 20210625023110.GI29179@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 28, 2021 at 02:40:09PM -0400, Tom Lane wrote:
> Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
> > These look strange to me - the inner parens don't do anything.
> > I wouldn't write it with 2x parens for the same reason I wouldn't write it with
> > 8x parens.
>
> Agreed, but shouldn't we just drop the excess parens rather than
> doubling down on useless notation?

I believe I got the impression from Michael that there was a style preference
to write != 0.

0002 is a bonus patch I found in my typos branch. I will hold onto it for
later if nobody wants to deal with it.

Attachment Content-Type Size
0001-Avoid-double-parens.patch text/x-diff 5.6 KB
0002-tablefunc.c-Fix-comment.patch text/x-diff 996 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-06-25 02:45:44 Re: SSL/TLS instead of SSL in docs
Previous Message Andrew Dunstan 2021-06-25 02:26:18 Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench