Re: get rid of Abs()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: get rid of Abs()
Date: 2022-10-04 13:29:36
Message-ID: 1819349.1664890176@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-10-04 15:34:09 Re: problems with making relfilenodes 56-bits
Previous Message Tom Lane 2022-10-04 13:16:44 Re: JUMBLE_SIZE macro in two files