From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Postgres hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Centralize use of PG_INTXX_MIN/MAX for integer limits |
Date: | 2018-11-24 15:41:45 |
Message-ID: | 25484.1543074105@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Michael Paquier <michael(at)paquier(dot)xyz> writes:
> A couple of years ago, 62e2a8dc has introduced in c.h a set of limits
> (to fix some portability issues from 83ff1618) to make the code more
> system-independent. Those are for example PG_INT32_MIN, etc. The core
> code now mixes the internal PG_ limits with the system ones. Would we
> want to unify a bit the whole thing and replace all the SHRT_MIN/MAX,
> LONG_MIN/MAX and such with the internal limit definitions?
I doubt it's really worth the trouble. I did just make such a change in
commit cbdb8b4c0, but it was mostly (a) so that the different ftoiN/dtoiN
functions would look more alike, and (b) because the relevant variables or
result values were actually declared int16, int32, etc. It would be flat
wrong to replace SHRT_MIN or LONG_MIN in a context where it was used to
check whether a value would fit in a variable declared "short" or "long".
> I suspect that the buildfarm does not have any more members where
> sizeof(int) is 2.
I doubt PG has ever been able to run on two-byte-int hardware. Certainly
not in the buildfarm era.
> I am seeing close to 250 places in the core code,
> most of them for INT_MIN and INT_MAX.
You'd really need to look at the associated variables to see whether any
of those would be better off as INT32_MIN/MAX.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Malik Rumi | 2018-11-24 16:00:51 | Re: could not connect to server, in order to operate pgAdmin/PostgreSQL |
Previous Message | Alvaro Herrera | 2018-11-24 15:36:09 | Re: [HACKERS] pgbench - allow to store select results into variables |