Re: Propose a new function - list_is_empty - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Propose a new function - list_is_empty
Date
Msg-id 1754766.1660744099@sss.pgh.pa.us
Whole thread Raw
In response to Re: Propose a new function - list_is_empty  (Junwang Zhao <zhjwpku@gmail.com>)
Responses Re: Propose a new function - list_is_empty
List pgsql-hackers
Junwang Zhao <zhjwpku@gmail.com> writes:
> There are some places that add extra parenthesis like here
>   while (list_length(sortclause) > list_length(previous) &&
> -        list_length(new_elems) > 0)
> +        (new_elems != NIL))

> Is it necessary to add that extra parenthesis?

I'd drop the parens in these particular examples because they are
inconsistent with the other parts of the same "if" condition.
I concur with Daniel's point that parens can be useful as a visual
aid even when they aren't strictly necessary --- but I don't think
we should make future readers wonder why one half of the "if"
is parenthesized and the other isn't.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: Amcheck verification of GiST and GIN
Next
From: Peter Eisentraut
Date:
Subject: Re: [RFC] building postgres with meson - v11