Re: Remove PointerIsValid()

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove PointerIsValid()
Date: 2025-09-17 15:54:46
Message-ID: CA+TgmoaRMgsO3WonpJt2dsGB+R04x8QhdQWBPdXvv8bnrce59w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 17, 2025 at 4:12 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> Given the context of replacing PointerIsValid(x), I think if (foo != NULL) is slightly better than if (x), because that explicitly 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-09-17 16:01:47 Re: Parallel heap vacuum
Previous Message vignesh C 2025-09-17 15:54:25 Re: Logical Replication of sequences