Re: Centralize use of PG_INTXX_MIN/MAX for integer limits
От | Tom Lane |
---|---|
Тема | Re: Centralize use of PG_INTXX_MIN/MAX for integer limits |
Дата | |
Msg-id | 25484.1543074105@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Centralize use of PG_INTXX_MIN/MAX for integer limits (Michael Paquier <michael@paquier.xyz>) |
Список | pgsql-hackers |
Michael Paquier <michael@paquier.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
В списке pgsql-hackers по дате отправления: