Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vStkh-008exz-2v for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Dec 2025 09:11:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vStkg-003tcx-1k for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Dec 2025 09:11:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vStkg-003tcp-0s for pgsql-hackers@lists.postgresql.org; Tue, 09 Dec 2025 09:11:22 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vStke-0040oK-2K for pgsql-hackers@lists.postgresql.org; Tue, 09 Dec 2025 09:11:22 +0000 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-b9a2e3c4afcso605905a12.1 for ; Tue, 09 Dec 2025 01:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765271477; x=1765876277; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AIkZKjYHHYYIyNI0QNrQuheDepuOuM9rpBxSyTufkIE=; b=KgrEgGn9rKXuG197zyNbLDwrer5x3AG0LiABXzmbeKk+tJqKo4c6cDtM2pqAHyCTLP gatr6zRBtbojeJwu6AkS/FQTU2FQucaQkltYoBJd5Txs5vJ+wZVcFplRSuXBZyowqbX5 bNlXWnptBFFKan5Y7T+hxDmOJ/Og/v/WKkq/0+w+e3ga4PzIdD67PuS5xrLOSEKW0mfZ i86hu1GrHuKMNR0oLVxlIK5GweDnERN8iGnXwNzmHeyiyFk9afgry5/BR4/gd6zNpsC+ VhkCV9RKo5CIpfH7HlNUSSm0EDxOKXxy68uIbJqZ84pTJmsnzY2EZROLqCx08GYoN3D+ 8/5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765271477; x=1765876277; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=AIkZKjYHHYYIyNI0QNrQuheDepuOuM9rpBxSyTufkIE=; b=ddAH3WKtGB4m3De0J16tXZ4IOQRt6LDN+5Uqb+KzNDiNe1u+N9B1Ra0wvAoW4kq65w dAoCwcv13949mNFC6Tux2lPAPohhaH5UvNVLjq0YB+pnWaORpbJjME7rwruMD9LX+MS6 /wycFwvud5EgoD+6pkSlJDyLSOgtOeBB1cJqUp49f+aCUTy9XovQtYQKoTDSWJAql/Pf MdgUlM0z/WFk6ob9Ob9NO9A4RgArcGfcG2EaUFLqMXRUTzr1TPQru5yGoDXs+DgNjWOg hhRLNXig0rROFWlqVzKG6M0Cy9pLj9FqcXuWSrhMp5GoEP8dy2JGETNwjz5AWPM9ipXW CsWQ== X-Forwarded-Encrypted: i=1; AJvYcCUCdZnyXm4ZsI9RxGlDqG0JpDurUy5ebFYB/fzEV/sejHcHB9J7Qtac4Cc27bErCej+aO+3MuObQK0pQP8w@lists.postgresql.org X-Gm-Message-State: AOJu0YzSJdAzGbZEG49W9lhE/hWoJ8N+LguJ+H96Eecvm8MmFKTTU1p3 w+1H8WD9UPPM63mVDvk9yaWGVx4SbrzIgqREMzWJ8HYAU87VAzq8juUQintNLoaz+NtLPxcCVN+ Zbj5/y85DBAYtUwAEr5g67ukBiAmhvqk= X-Gm-Gg: ASbGnctYCWEjcP5M0d85bbhk+BJUIQa74zfo+f/e6o5CxNFJMjhkN8n8dbTgIQkcDur yjkpY9mfpS5vO/hRLR5tHzn0ujqiSmcibfGl+gQkeITKsub0mVjs9dT1MwvzA45cKeK5zVEikqy n2RHFlOGgNPLDKng4kV1RC3Iw3YrHKHBGvKysClCUg2843eJWfIL7VlDH+xDOnqv9D8fhqFs0V2 Ud8HrMI4EYflIT0xmcrRXWPzoiGrooaA/YMDlTqBc6pU7OZNbgXjlRS6cuZKMqww5hTlk85LS12 iVKl17AHC/RWdEepu4xBaAyWHFwsxqH/xQF8def+vYsJVW7j9POU0kjdhoMe7RFgS/PBJMZ0hwm lhlNJHo3t5A== X-Google-Smtp-Source: AGHT+IGcwyRKPDszGoB/pLvn4R5cZyLhO9xbGDH9cYyVgb45ZFUfnO1qD5dHV1qEFcbFDd+0ltxTfRWbjT9J7pZvLVM= X-Received: by 2002:a05:7300:1486:b0:2a4:3593:5fc8 with SMTP id 5a478bee46e88-2abf3164cb0mr826113eec.2.1765271477238; Tue, 09 Dec 2025 01:11:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Thomas Munro Date: Tue, 9 Dec 2025 22:10:39 +1300 X-Gm-Features: AQt7F2r3ITuy25yyRuK6zwMftBD7NekCxACmovlb82pWIF_-IgC0IQ0fWf7HsqA Message-ID: Subject: Re: Safer hash table initialization macro To: Bertrand Drouvot Cc: Jelte Fennema-Nio , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Dec 9, 2025 at 8:27=E2=80=AFPM Bertrand Drouvot 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::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.