Re: Remove PointerIsValid()

From: David Rowley <dgrowleyml(at)gmail(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 20:23:46
Message-ID: CAApHDvqi-SGNAHJxYpe7gPz_bZx5_qkB4MJxJTKVhHT6forO2A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 18 Sept 2025 at 03:55, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> 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.

+1. I generally do (var != NULL) for pointers rather than (var). I
think it makes the code easier to read as a reader instantly knows
"var" is a pointer and not an int or bool.

Also, agree that we can relax that a little when all the surrounding
code does (var)

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2025-09-17 20:35:06 Re: REPACK and naming
Previous Message Dmitry Mityugov 2025-09-17 20:18:22 Re: --with-llvm on 32-bit platforms?