Re: get rid of Pointer type, mostly

Поиск
Список
Период
Сортировка
От David Geier
Тема Re: get rid of Pointer type, mostly
Дата
Msg-id 7c7e1e59-284b-49f6-a496-17dd4170f979@gmail.com
обсуждение исходный текст
Ответ на Re: get rid of Pointer type, mostly  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On 24.11.2025 20:52, Robert Haas wrote:
> On Mon, Nov 24, 2025 at 2:38 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Well, either Peter just ran out of energy or there is actually some
>> notational value in Pointer.  If it's the latter, I'd like to know.
> 
> I agree that would be nice to know.
> 
> Peter's original email seemed to indicate that he was deterred by this
> sort of thing:
> 
>      Pointer   **extra_data = (Pointer **) PG_GETARG_POINTER(4);
> 
> If Pointer is merely char *, then this is equivalent to:
> 
>      char   ***extra_data = (char ***) PG_GETARG_POINTER(4);
> 
> I believe this is the same extra_data that is documented thus:

I figured the same while doing the change.

> So in other words, it's a pointer to an array of generic pointers. In
> a vacuum, I'd suggest that having three levels of indirection that are
> all semantically different but all denoted by an asterisk in C is
> confusing enough to be a bad idea regardless of the specifics. But
> since we've already crossed that bridge, we'll just need to make the
> best of it. Maybe we could use a more specific typedef here, like
> GinExtraPointer. That would be a lot more greppable than just writing
> Pointer, and every GinExtraPointer would be the same flavor of generic
> pointer, whereas any given Pointer is not necessarily related in any
> semantic way to any other.

I went with your proposal of GinExtraPointer. See attached patch. It's
based on the series of patches from Peter's initial mail. I've included
the removal of the Pointer typedef in the same patch.

--
David Geier
Вложения

В списке pgsql-hackers по дате отправления: