Re: Change atoi to strtol in same place - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Change atoi to strtol in same place
Date
Msg-id 15840.1570654287@sss.pgh.pa.us
Whole thread Raw
In response to Re: Change atoi to strtol in same place  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-hackers
David Rowley <david.rowley@2ndquadrant.com> writes:
> On Tue, 8 Oct 2019 at 19:46, Joe Nelson <joe@begriffs.com> wrote:
>> David Rowley wrote:
>>> The translation string here must be consistent over all platforms. I
>>> think this will cause issues if the translation string uses %ld and
>>> the platform requires %lld?

>> A very good and subtle point. I'll change it to %lld so that a single
>> format string will work everywhere.

> The way to do this is to make a temp buffer and snprintf into that
> buffer then use %s.

We have done it that way in the past, but it was mainly because we
couldn't be sure that snprintf was on board with %lld.  I think that
the new consensus is that forcing use of "long long" is a less messy
solution (unless you need to back-patch the code).  See commit
6a1cd8b92 for recent precedent.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Dave Cramer
Date:
Subject: Re: let's make the list of reportable GUCs configurable (was Re: Add%r substitution for psql prompts to show recovery status)
Next
From: Peter Eisentraut
Date:
Subject: Re: Standby accepts recovery_target_timeline setting?