Re: Make copyObject work in C++

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Jelte Fennema-Nio <postgres@jeltef.nl>, Andres Freund <andres@anarazel.de>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Thomas Munro <thomas.munro@gmail.com>
Date: 2026-01-26T10:29:42Z
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++.




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Enable test_cplusplusext with MSVC

  2. Disable some C++ warnings in MSVC

  3. meson: Make room for C++-only warning flags for MSVC

  4. Make fixed-length list building macros work in C++

  5. Make unconstify and unvolatize use StaticAssertVariableIsOfTypeMacro

  6. Use typeof everywhere instead of compiler specific spellings

  7. Test List macros in C++ extensions

  8. Test most StaticAssert macros in C++ extensions

  9. Revert "Change copyObject() to use typeof_unqual"

  10. Fix for C++ compatibility

  11. tests: Add a test C++ extension module