Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nV2NM-0000Gc-Fp for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Mar 2022 02:30:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nV2NK-0004kM-6i for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Mar 2022 02:29:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nV2NJ-0004k9-U7 for pgsql-hackers@lists.postgresql.org; Fri, 18 Mar 2022 02:29:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nV2NH-0007mk-ES for pgsql-hackers@lists.postgresql.org; Fri, 18 Mar 2022 02:29:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 22I2TjEj993504; Thu, 17 Mar 2022 22:29:45 -0400 From: Tom Lane To: Kyotaro Horiguchi cc: orlovmg@gmail.com, pashkin.elfe@gmail.com, japinli@hotmail.com, aekorotkov@gmail.com, peter.eisentraut@enterprisedb.com, aleksander@timescale.com, ilan@tzirechnoy.com, pgsql-hackers@lists.postgresql.org Subject: Re: XID formatting and SLRU refactorings In-reply-to: <20220318.102008.1520874436937792329.horikyota.ntt@gmail.com> References: <20220318.102008.1520874436937792329.horikyota.ntt@gmail.com> Comments: In-reply-to Kyotaro Horiguchi message dated "Fri, 18 Mar 2022 10:20:08 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <993502.1647570585.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 17 Mar 2022 22:29:45 -0400 Message-ID: <993503.1647570585@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Kyotaro Horiguchi writes: > At Thu, 17 Mar 2022 19:25:00 +0300, Maxim Orlov wrot= e in = >> +/* printf/elog format compatible with 32 and 64 bit xid. */ >> +typedef unsigned long long XID_TYPE; >> ... >> + errmsg_internal("found multixact %llu from before relminmxid %llu", >> + (XID_TYPE) multi, (XID_TYPE) relminmxid))); > "(XID_TYPE) x" is actually equivalent to "(long long) x" here, but the > point here is "%llu in format string accepts (long long)" so we should > use literally (or bare) (long long) and the maybe-all precedents does > that. Yes. Please do NOT do it like that. Write (long long), not something else, to cast a value to match an "ll" format specifier. Otherwise you're just making readers wonder whether your code is correct. regards, tom lane