Re: Make copyObject work in C++

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Make copyObject work in C++
Date: 2026-01-26 10:29:42
Message-ID: df1834bc-f640-4d26-be81-a84f6da33c46@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25.01.26 18:52, Jelte Fennema-Nio wrote:
> On Sun Jan 25, 2026 at 5:50 PM CET, Andres Freund wrote:
>> I'm pretty sceptical this is the right direction.
>
> The only other option I can think of is not supporting C++ extension on
> MSVC unless they are compiled with C++20 (or later). I don't
> particularly care about Windows C++ extensions myself, so I personally
> would be fine with that choice. It seems a bit harsh, though.

Maybe it would be enough to only support PG_MODULE_MAGIC (without
arguments) in C++ for now.

That would still require removing the named initializers inside
PG_MODULE_MAGIC_DATA(), but that's only an internal change, and it would
not affect C-language users of PG_MODULE_MAGIC_EXT, and we wouldn't lock
ourselves into a particular style in C++.

Then, maybe in a couple of years, when C++20 is more widely available,
we could enable PG_MODULE_MAGIC_EXT for C++, or design an alternative
construct for C++.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2026-01-26 10:43:54 Re: Make copyObject work in C++
Previous Message Bertrand Drouvot 2026-01-26 10:26:11 Re: Safer hash table initialization macro