Re: Make foreach_ptr macro work in C++ extensions

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Make foreach_ptr macro work in C++ extensions
Date: 2024-10-14 20:29:34
Message-ID: Zw1_Lqa7cB4wbYtY@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 14, 2024 at 10:05:42PM +0200, Jelte Fennema-Nio wrote:
> I've been writing a C++ extension recently and it turns out that the
> foreach_ptr macro added in PG17 by one of my patches causes a
> compilation failure when used in C++. This is due to C++ its stricter
> rules around implicit casts from void pointers.

Whoops.

> Attached is a tiny patch that fixes that by adding an explicit cast to
> the macro.

Looks reasonable to me.

> I think it would be good to backpatch this to PG17 as well,
> as to not introduce some differences in the macro across versions.

I'd consider this a "low-risk" fix, which our versioning page [0] says is
acceptable for a minor release, so I'll plan on back-patching unless
someone objects.

[0] https://www.postgresql.org/support/versioning/

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2024-10-14 20:31:11 Re: Doc: typo in config.sgml
Previous Message Alena Rybakina 2024-10-14 20:20:11 Re: Logging parallel worker draught