From: Bruce Momjian <bruce@momjian.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Subject: Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign
Date: Thu, 30 Apr 2015 09:21:05 -0400
Message-ID: <20150430132105.GA24214@momjian.us> (raw)
In-Reply-To: <CA+TgmoaUGrL4-zFLMJhuZrW6fZA9sTFFjHtNxLHdkzgkyhtH4g@mail.gmail.com>
References: <E1YnGP2-0007iQ-C7@gemulon.postgresql.org>
<20150429141102.GX30322@tamriel.snowman.net>
<CA+TgmoYAQ2H3RZoY0ipLg_7LjYMgqrdpEh_y4g_ruPhUhpSDnQ@mail.gmail.com>
<20150429182222.GB30322@tamriel.snowman.net>
<20150429210524.GP31727@momjian.us>
<CA+TgmoaUGrL4-zFLMJhuZrW6fZA9sTFFjHtNxLHdkzgkyhtH4g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
On Thu, Apr 30, 2015 at 09:07:45AM -0400, Robert Haas wrote:
> >> > > Since abs() is declared to return just an int. I don't see it anywhere
> >> > > in our tree and I'm not sure how portable it actually is, but labs() is
> >> > > supposedly in C89, so perhaps that should be used here instead?
> >> >
> >> > I just removed the "l" for now, since %02d is used to print the result
> >> > of abs() elsewhere. If that isn't right, someone can re-fix my fix.
> >>
> >> Works for me. I'm no longer seeing the warning.
> >
> > Oh, I see now that my commit generated a conflict and didn't apply.
> > Should we try labs() or just ignore it?
>
> If the result is guaranteed to fit in an integer, then there's no
> reason to adopt labs. If you think there are platforms where it would
> overflow int but fit into long, then there might be a reason to change
> it. All things being equal, it'd be nicer if we didn't need to use
> labs(), because every function we depend on is another thing that can
> break on some obscure platform.
I think abs() is fine; there is no risk of overflow from mod; thanks.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: bruce@momjian.us, robertmhaas@gmail.com, sfrost@snowman.net
Subject: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign
In-Reply-To: <20150430132105.GA24214@momjian.us>
References: <E1YnGP2-0007iQ-C7@gemulon.postgresql.org> <20150429141102.GX30322@tamriel.snowman.net> <CA+TgmoYAQ2H3RZoY0ipLg_7LjYMgqrdpEh_y4g_ruPhUhpSDnQ@mail.gmail.com> <20150429182222.GB30322@tamriel.snowman.net> <20150429210524.GP31727@momjian.us> <CA+TgmoaUGrL4-zFLMJhuZrW6fZA9sTFFjHtNxLHdkzgkyhtH4g@mail.gmail.com> <20150430132105.GA24214@momjian.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox