Re: Safer hash table initialization macro

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: Safer hash table initialization macro
Дата
Msg-id CA+hUKGLYn6jxMSptjzMqBZ7ZYKQ2cewiKjg31zUR+ZR3E+mu+Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Safer hash table initialization macro  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Ответы Re: Safer hash table initialization macro
Список pgsql-hackers
On Tue, Dec 9, 2025 at 8:27 PM Bertrand Drouvot
<bertranddrouvot.pg@gmail.com> wrote:
> On Mon, Dec 08, 2025 at 11:53:02AM +0100, Jelte Fennema-Nio wrote:
> > On Sat Dec 6, 2025 at 1:56 AM CET, Thomas Munro wrote:
> +#if defined(__cplusplus)
> +#define pg_expr_has_type_p(expr, type) (std::is_same<decltype(expr), type>::value)
> +#else
> +#define pg_expr_has_type_p(expr, type) \
> +       _Generic((expr), type: 1, default: 0)
> +#endif
>
> What about relying on the existing __builtin_types_compatible_p() instead of
> _Generic() here?

If we used standard C/C++ it'd work on MSVC too.



В списке pgsql-hackers по дате отправления: