Thread
-
Re: Safer hash table initialization macro
Thomas Munro <thomas.munro@gmail.com> — 2025-12-09T09:10:39Z
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.