Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ofhzW-0002eO-Lk for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Oct 2022 13:29:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ofhzV-0003Bv-3t for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Oct 2022 13:29:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ofhzU-0003Bl-Qr for pgsql-hackers@lists.postgresql.org; Tue, 04 Oct 2022 13:29:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ofhzO-0005PE-DM for pgsql-hackers@postgresql.org; Tue, 04 Oct 2022 13:29:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 294DTah31819350; Tue, 4 Oct 2022 09:29:36 -0400 From: Tom Lane To: Peter Eisentraut cc: pgsql-hackers Subject: Re: get rid of Abs() In-reply-to: <4beb42b5-216b-bce8-d452-d924d5794c63@enterprisedb.com> References: <4beb42b5-216b-bce8-d452-d924d5794c63@enterprisedb.com> Comments: In-reply-to Peter Eisentraut message dated "Tue, 04 Oct 2022 09:07:36 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1819348.1664890176.1@sss.pgh.pa.us> Date: Tue, 04 Oct 2022 09:29:36 -0400 Message-ID: <1819349.1664890176@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > I was wondering why we have a definition of Abs() in c.h when there are > more standard functions such as abs() and fabs() in widespread use. I > think this one is left over from pre-ANSI-C days. The attached patches > replace all uses of Abs() with more standard functions. I'm not in favor of the llabs() changes. I think what we really want in those places, or at least most of them, is "abs() for int64". That could be had by #define'ing "iabs64" (or some name along that line) as labs or llabs depending on which type we are using for int64. Seems OK beyond that nitpick. regards, tom lane