Re: Make copyObject work in C++ - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Make copyObject work in C++
Date
Msg-id 8f8776be-6d8f-4e1c-8d21-e55052edd91b@eisentraut.org
Whole thread Raw
In response to Re: Make copyObject work in C++  ("Jelte Fennema-Nio" <postgres@jeltef.nl>)
Responses Re: Make copyObject work in C++
List pgsql-hackers
On 13.02.26 11:28, Jelte Fennema-Nio wrote:
> Patch 3 makes copyObject work when using GCC or Clang with -std=c++11 by
> introducing pg_exprtype.
> 
> Patch 4 starts using pg_exprtype in more places.

I found this paper

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2927.htm

which led to the addition of typeof into the C standard.

It contains a section 'Why not "decltype"?' that explains how decltype 
is different, but it also explains that if typeof were added to C++, 
then it would be

     std::remove_reference_t<decltype(T)>

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.




pgsql-hackers by date:

Previous
From: Fabrice Chapuis
Date:
Subject: Re: incremental backup issue
Next
From: Richard Guo
Date:
Subject: Remove obsolete SAMESIGN macro