Subject: Re: Make foreach_ptr macro work in C++ extensions

From: Nathan Bossart <[email-masked]>
Date: Mon, 14 Oct 2024 15:29:34 -0500

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

---

From: Bruce Momjian <[email-masked]>
Date: Mon, 14 Oct 2024 16:31:59 -0400

> acceptable for a minor release, so I'll plan on back-patching unless

Agreed.

-- 
  Bruce Momjian  <[email-masked]>        https://momjian.us
  EDB                                      https://enterprisedb.com

  When a patient asks the doctor, "Am I going to die?", he means 
  "Am I going to die soon?"

---

From: Nathan Bossart <[email-masked]>
Date: Tue, 15 Oct 2024 16:25:50 -0500

Committed.

-- 
nathan