Re: Make copyObject work in C++

From: "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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: 2025-12-08 08:11:59
Message-ID: DESOMJEHA095.2MY9A7RE7AVT1@jeltef.nl
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun Dec 7, 2025 at 8:45 PM CET, Tom Lane wrote:
> #ifdef __cplusplus
> #undef typeof
> #define typeof decltype
> #define HAVE_TYPEOF 1
> #endif

Went with defining pg_exprtype (pg_typeof already exists). Undefining
typeof seemed a bit heavy-handed. Especially since I think it would be
nice to backport this so C++ extensions can use copyObject directly.

> BTW, grepping finds a number of random references to __typeof__ and
> __typeof, which probably ought to be updated to be just typeof.

Added a follow on patch that starts using pg_exrtype in all those
places.

Attachment Content-Type Size
v2-0001-Make-copyObject-work-in-C.patch text/x-patch 2.1 KB
v2-0002-Use-pg_exprtype-instead-of-__typeof__-or-__typeof.patch text/x-patch 3.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bilal Yavuz 2025-12-08 08:12:22 Re: meson and check-tests
Previous Message Peter Eisentraut 2025-12-08 08:00:55 Re: Make copyObject work in C++