Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fK5Ps-0001eY-1Z for pgsql-hackers@arkaria.postgresql.org; Sat, 19 May 2018 17:13:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fK5Pq-0001X0-Fj for pgsql-hackers@arkaria.postgresql.org; Sat, 19 May 2018 17:13:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fK5Pq-0001Wm-98 for pgsql-hackers@lists.postgresql.org; Sat, 19 May 2018 17:13:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fK5Pi-0004qQ-WB for pgsql-hackers@lists.postgresql.org; Sat, 19 May 2018 17:13:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w4JHD0JX013104 for ; Sat, 19 May 2018 13:13:00 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org Subject: printf format selection vs. reality MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13102.1526749980.1@sss.pgh.pa.us> Date: Sat, 19 May 2018 13:13:00 -0400 Message-ID: <13103.1526749980@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Our configure script goes to considerable lengths to try to identify what printf width modifier to use for int64 values. In particular see PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER, which claims # MinGW uses '%I64d', though gcc throws a warning with -Wall, # while '%lld' doesn't generate a warning, but doesn't work. However, if we decide that we ought to use our own snprintf replacement, we throw that info away and set INT64_FORMAT to "%lld" which we know is what that code uses. This was all right when that code was first written, when we had only a very small number of uses of INT64_FORMAT and they all were in snprintf() calls. It's been a long time since that was true: pgbench, in particular, has been passing INT64_FORMAT to the native printf with increasing enthusiasm. In reality, we do not anymore work with situations where our snprintf has a different idea about this format modifier than libc does. What's more, as far as I can find, we do not have any buildfarm members that set INT64_MODIFIER to anything other than "l" or "ll", which no doubt explains why we've not noticed a problem. The comment quoted above doesn't seem to apply to any current buildfarm members. I think we should abandon the pretense that we can work with libc printfs that accept anything but "l"/"ll", and rip out the excess complexity in configure, just setting INT64_MODIFIER to "l" or "ll" depending on whether "int64" is "long" or "long long". Comments? regards, tom lane