Re: INT64_MIN and _MAX - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: INT64_MIN and _MAX
Date
Msg-id 87619tc5wc.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: INT64_MIN and _MAX  (Andres Freund <andres@anarazel.de>)
Responses Re: INT64_MIN and _MAX
List pgsql-hackers
>>>>> "Andres" == Andres Freund <andres@anarazel.de> writes:

 >> Hm, it looks like the same could be said for INT32_MIN and _MAX;
 >> some places use INT_MIN etc., others say "we shouldn't assume int =
 >> int32" and use (-0x7fffffff - 1) or whatever instead.

 Andres> I have been annoyed by this multiple times. I think we should
 Andres> make sure the C99 defines are there (providing values if they
 Andres> aren't) and always use those. We've used them in parts of the
 Andres> tree long enough that it's unlikely to cause problems. Nothing
 Andres> is helped by using different things in other parts of the tree.

 Andres> Willing to cook up a patch?

How's this one?

This replaces the one I posted before; it does both INT64_MIN/MAX and
INT32_MIN/MAX, and also int16/int8/uint*. Uses of 0x7fffffff in code
have been replaced unless there was a reason not to, with either INT_MAX
or INT32_MAX according to the type required.

What I have _not_ done yet is audit uses of INT_MIN/MAX to see which
ones should really be INT32_MIN/MAX.

--
Andrew (irc:RhodiumToad)


Attachment

pgsql-hackers by date:

Previous
From: Воронин Дмитрий
Date:
Subject: Re: New functions
Next
From: Florian Weimer
Date:
Subject: Re: Remove fsync ON/OFF as a visible option?