Re: get rid of Pointer type, mostly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: get rid of Pointer type, mostly
Date: 2025-11-24 16:33:57
Message-ID: 957744.1764002037@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Nov 24, 2025 at 11:09 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> The second is getting rid of uses of Pointer for variables where you
>>> might as well use void * directly. These are actually not that many.

>> ... but not of that. In particular, I think it's just fine if
>> DatumGetPointer and PointerGetDatum take and return Pointer.

> What's your objection?

We have lots of places where we use trivial typedefs to annotate
what something is. For instance "text *" is not really different
from "struct varlena *", but I don't think anyone would be in favor
of removing the "text" typedef. In this case we have decades of
practice using Pointer to annotate something as being a generic
pointer. I'm in favor of switching it to be "void *" to conform
more closely to modern C semantics, but not of just trying to get
rid of it. Especially so if the removal is incomplete. What have
you really accomplished then?

> (I don't have a considered opinion on this particular point, but in
> general I've found that using Pointer seems to make life worse rather
> than better.)

How much of that comes from "char *" versus "void *"?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2025-11-24 16:45:13 Re: Missing wait events (gap analysis)
Previous Message Greg Burd 2025-11-24 16:28:28 Re: [PATCH] Fix ARM64/MSVC atomic memory ordering issues on Win11 by adding explicit DMB ​barriers