Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YnoP0-0003kZ-LW for pgsql-committers@arkaria.postgresql.org; Thu, 30 Apr 2015 13:21:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YnoOz-0004bn-UT for pgsql-committers@arkaria.postgresql.org; Thu, 30 Apr 2015 13:21:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YnoOy-0004a1-OT for pgsql-committers@postgresql.org; Thu, 30 Apr 2015 13:21:16 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YnoOq-0004Gf-8L for pgsql-committers@postgresql.org; Thu, 30 Apr 2015 13:21:15 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1YnoOn-0006O0-N9; Thu, 30 Apr 2015 09:21:05 -0400 Date: Thu, 30 Apr 2015 09:21:05 -0400 From: Bruce Momjian To: Robert Haas Cc: Stephen Frost , pgsql-committers Subject: Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign Message-ID: <20150430132105.GA24214@momjian.us> References: <20150429141102.GX30322@tamriel.snowman.net> <20150429182222.GB30322@tamriel.snowman.net> <20150429210524.GP31727@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org 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 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