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 1vRWra-00FFA5-0U for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Dec 2025 14:32:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vRWrX-008Lve-2y for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Dec 2025 14:32:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vRWrX-008LvW-1y for pgsql-hackers@lists.postgresql.org; Fri, 05 Dec 2025 14:32:47 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vRWrV-003I3k-1P for pgsql-hackers@lists.postgresql.org; Fri, 05 Dec 2025 14:32:47 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-37e578d04b5so19117981fa.1 for ; Fri, 05 Dec 2025 06:32:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeltef.nl; s=google; t=1764945164; x=1765549964; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YSEufrMVVEaNMxxPL/t+vRTHQv7hq1CJgma5bJMDBx4=; b=J04zGVVLH8wS0GVP0UC6LQgv52rxwxPJpLDbuZyq3iwr/VWrs6SR0ixt3OLWhYJBy1 GksDfW6wSLwPXcFXxbUNGiZZcAvPNyVxJvzjC6e3wNLNcqoPK4UhXccI8IXyss8FEUQ1 iciuzisJlghk8FBIcjB8YBl8TTgbxgc8Sc77eTHjlAMF1V/9hDsquXMBdErQHkHdQnKd Jm+PmwhlrzPDa+IBWV4BErGjc3g6dxmcS4vxxvrZUyTVcPOhDbfh+n8J865r1HlMCmwn afNnqIXb+VtEerCMnHTjJu+M19MqY/f+bqBxw2wn6uaqJJ8mPWtrOu52r7QLGbdPiXdR Oz3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764945164; x=1765549964; h=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=YSEufrMVVEaNMxxPL/t+vRTHQv7hq1CJgma5bJMDBx4=; b=hAxUckpFCiWBF46HU8ed+Lbbh8tsHYOGJNeAEjt3w++Vv0yh3NyzPjNEKUDITmnLIt 4Q/G+Vj7oG0X9mGgVkUtpxcIMnONGrMp3G4ACBjaHqdvrtxoCtXCpL5X9WYW4aqy8Y91 HxMOaZY53NejeCae/xBBrFmsqg1pT+OlIGPFEYc5WMO8WjOnc/iYsV+C9yiOYLla6eHC Ysa4GxctUb0a8oCDQelB8XsPPOU4Rac5YmTXu51eMc7a2CJWrB0S/ebhcQU2wYIX8g/T mjkwG0ZEo/aGUma9V4GEnwuuYRGZWt/5UpSvP4HKWJhnnXFSiVMLh7ueNJYvOIaNhXYv OdeA== X-Forwarded-Encrypted: i=1; AJvYcCW+vDhcLayqaV3SrBhnYnqXsg/M8dyG1Z8DKJ24KPEB0X0T03wR3ivbYDlCsCP42l7jwH+7D2qUtNFKX3zm@lists.postgresql.org X-Gm-Message-State: AOJu0Yz560i7VCO/MGDSl75Zof2fJLGB6BrPU4F/6HhC3FjMpps+Wtop BlDHQGFs98Ifxh39foUvS3Ev/CTbg5/7weVaphfRgAcUpvg5bfzOsBKtoiohP3UyT3dhrepuNgi wpCyXcZ3NyLgt53LYVtwzdMXsXHG1/SL+4QH1N0wlng== X-Gm-Gg: ASbGncvgyGU8IR5ll0odztkRfJhO2hMLmZUYVnNGLjgIhYMMoDmgnj+QE/iQv6PXJWT Qs2cIOz4Be7qFc89U7qD0ZXjO8r6KRfWFzP1qccIlkoWFM80YfIUQ/DsI71YBgt+Yll9fRwuM84 sX+Y8EcAKdpVE2nj+8VWu4A1y6oEMqO28clNUmApzWkCtGK0S8O4jx8B2FIV89tE+XLYK2ZBSQv n1SYm7QxkZSl4Pdujn+WjSpFJPARFy0DvkaSbC7ziiaYwkNCk/j7Iq9nYSCQBMkEB2ZlhWJGSNE 20zL X-Google-Smtp-Source: AGHT+IF+5xFXBI93Npa+c8JxkQy6Q/EeR7nHURLxv7qRxvLtsUkV3Yh781uZKNx29otSrXO1mHPomePJq+MNUstUP8U= X-Received: by 2002:a2e:9b8e:0:b0:37a:31da:47bf with SMTP id 38308e7fff4ca-37e6df20870mr14469011fa.42.1764945164279; Fri, 05 Dec 2025 06:32:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jelte Fennema-Nio Date: Fri, 5 Dec 2025 15:32:32 +0100 X-Gm-Features: AWmQ_bnO7A_XX6FsIA3yv5SjS0293h1JrtBGsHtZGG40fSw7fWNm9YecdpFcgW4 Message-ID: Subject: Re: Safer hash table initialization macro To: Thomas Munro Cc: Bertrand Drouvot , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 5 Dec 2025 at 02:30, Thomas Munro wrote: > How much of our header stuff is supposed to work from C++ too? I think it's nice if it works, but it doesn't seem the most important. Especially since C++ has its own hashmaps. And if it really needs to create a hashmap it's still possible to call the. > I suppose you could > write the typeof-based version you already hinted at, but only use it > for __cplusplus__ (where typeof exists as decltype). I tried to figure something out that would work in C++ (with help of Claude), but I wasn't able to create a version of the macros without also needing to add: #ifdef __cplusplus } #include extern "C" { #endif It seems quite ugly to escape the extern "C" from the parent like that and then re-enter it. Overall it doesn't seem worth the hassle to me to make these macros work in C++. > Another consideration is what impact we have on the Rust world, and > potentially other languages used for extensions that call C via FFI > etc FFI generally cannot call macros anyway, only actual symbols.