Re: Make copyObject work in C++

From: "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl>
To: "Peter Eisentraut" <peter(at)eisentraut(dot)org>
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-02-20 09:47:40
Message-ID: DGJP03W74JEL.3QCBCVYISLNQ6@jeltef.nl
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu Feb 19, 2026 at 9:31 AM CET, Peter Eisentraut wrote:
> What I suggest we should do here is:
>
> 1. Add a configure test that checks if the C++ compiler supports typeof.
>
> 2. If not, #define typeof to the above expression.
>
> Then code can continue to use typeof unchanged.

Makes total sense, I didn't realise decltype and typeof were not quite
the same thing. Attached is an updated patchset that does that.

It also includes a patch that improves unconstify and unvolatize by
using StaticAssertVariableIsOfTypeMacro instead of a custom version of
that assertion. (Like I said, in a future patch I intend to make
StaticAssertVariableIsOfTypeMacro work in C++ as well, but this seemed
like a good improvement anyway)

Attachment Content-Type Size
v9-0001-Support-using-copyObject-in-C.patch text/x-patch 7.7 KB
v9-0002-Use-typeof-everywhere-instead-of-compiler-specifi.patch text/x-patch 2.3 KB
v9-0003-Make-unconstify-and-unvolatize-use-StaticAssertVa.patch text/x-patch 1.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-02-20 09:50:35 Re: Speed up COPY FROM text/CSV parsing using SIMD
Previous Message Ajit Awekar 2026-02-20 09:42:10 Re: [OAuth2] Infrastructure for tracking token expiry time