Re: Change atoi to strtol in same place

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Joe Nelson <joe(at)begriffs(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Surafel Temesgen <surafel3000(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: Change atoi to strtol in same place
Date: 2019-10-09 20:51:27
Message-ID: 15840.1570654287@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:
> On Tue, 8 Oct 2019 at 19:46, Joe Nelson <joe(at)begriffs(dot)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

In response to

Browse pgsql-hackers by date

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