On Mon, Aug 15, 2022 at 9:28 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Smith <smithpb2250@gmail.com> writes:
> > During a recent code review I was going to suggest that some new code
> > would be more readable if the following:
> > if (list_length(alist) == 0) ...
>
> > was replaced with:
> > if (list_is_empty(alist)) ...
>
> > but then I found that actually no such function exists.
>
> That's because the *correct* way to write it is either "alist == NIL"
> or just "!alist".
I think the alist == NIL (or alist != NIL) style often makes the code
easier to read. I recommend we standardize on that one.
--
Robert Haas
EDB: http://www.enterprisedb.com