Re: strtoll/strtoull emulation - Mailing list pgsql-hackers

From Andres Freund
Subject Re: strtoll/strtoull emulation
Date
Msg-id 20140603150435.GF1220@awork2.anarazel.de
Whole thread Raw
In response to Re: strtoll/strtoull emulation  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: strtoll/strtoull emulation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2014-06-03 10:55:17 -0400, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > I recently had the need to use strtoull() in postgres code. Only to
> > discover that that's not available on some platforms. IIRC windows/msvc
> > was one of them. Now 9d7ded0f4277f5c0063eca8e871a34e2355a8371 added
> > another user - guarded by HAVE_STRTOULL. That commit will make things
> > worse on windows btw...
> 
> Worse than what?  AFAICT, the old code would produce complete garbage
> on Windows.  The new code at least gives the right answer for rowcounts
> up to 4GB.

Hm? Wouldn't it only have produced garbage on mingw and not msvc?

> > How about adding emulation for strtoll/strtoull to port/? The BSDs have
> > easily crib-able functions available...
> 
> Ugh.  Surely Windows has got *some* equivalent, perhaps named differently?

Apparently they've added strtoull()/stroll() to msvc 2013... And there's
_strtoui64() which seems to have already existed a while back.

But it seems easier to me to add one fallback centrally somewhere that
works on all platforms. I am not sure that msvc is the only platform
missing strtoull() - although I didn't find anything relevant in a quick
search through the buildfarm. So maybe I am worrying over nothing.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Gurjeet Singh
Date:
Subject: Re: Proposing pg_hibernate
Next
From: Tom Lane
Date:
Subject: Re: pg_basebackup failed to back up large file