Re: Remove PointerIsValid() - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Remove PointerIsValid()
Date
Msg-id CA+TgmoaRMgsO3WonpJt2dsGB+R04x8QhdQWBPdXvv8bnrce59w@mail.gmail.com
Whole thread Raw
In response to Re: Remove PointerIsValid()  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: Remove PointerIsValid()
Re: Remove PointerIsValid()
List pgsql-hackers
On Wed, Sep 17, 2025 at 4:12 AM Chao Li <li.evan.chao@gmail.com> wrote:
> Given the context of replacing PointerIsValid(x), I think if (foo != NULL) is slightly better than if (x), because
thatexplicitly shows the intent of checking pointers, while if (x) works for both pointers and integers. 

I agree that we should prefer foo != NULL, but if the surrounding code
in a particular location just tests if (foo), then it may be better in
that case to go that route.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Logical Replication of sequences
Next
From: Robert Haas
Date:
Subject: Re: Parallel heap vacuum