From: | Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Remove PointerIsValid() |
Date: | 2025-09-17 16:26:25 |
Message-ID: | CAOYmi+nd_cxU=rTaBeRu-E3P1WQUZeJmUJ1DVXXVkb5NSWgt3A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Sep 16, 2025 at 10:21 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> I think there is agreement that the PointerIsValid() macro is pretty
> useless. This patch proposes to remove it. There have been a few
> recent mini-discussions in other threads that appear to support this. [0][1]
Patch LGTM, and I like your chosen balance of the two replacements.
On Wed, Sep 17, 2025 at 8:55 AM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> 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.
(I find `if (some_pointer)` to be very readable, idiomatic C, so I
would vote against standardization.)
--Jacob
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2025-09-17 16:32:16 | Re: Parallel heap vacuum |
Previous Message | Tomas Vondra | 2025-09-17 16:23:06 | Re: Parallel heap vacuum |