Re: use of int4/int32 in C code

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: use of int4/int32 in C code
Дата
Msg-id CA+TgmoZ4gNTQ=jo8V=KBvGy-em2cDyB0nRXDGFsPGGDZvjP5uA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: use of int4/int32 in C code  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: use of int4/int32 in C code  (Peter Geoghegan <peter@2ndquadrant.com>)
Re: use of int4/int32 in C code  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, Jun 19, 2012 at 9:47 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> What is the latest theory on using int4 vs. int32 in C code?
>> (equivalently int2, int16)
>
> I thought the general idea was to use int32 most places, but int4 in
> catalog declarations.  I don't think it's tremendously important if
> somebody uses the other though.

I concur with Peter that TMTOWTDI is not the right way to do this.  I
think we ought to get rid of int4 in code and use int32 everywhere.

>> While we're at it, how do we feel about using C standard types like
>> int32_t instead of (or initially in addition to) our own definitions?
>
> Can't get very excited about this either.  The most likely outcome of
> a campaign to substitute the standard types is that back-patching would
> become a truly painful activity.  IMO, anything that is going to result
> in tens of thousands of diffs had better have a more-than-cosmetic
> reason.  (That wouldn't apply if we only used int32_t in new code ...
> but then, instead of two approved ways to do it, there would be three.
> Which doesn't seem like it improves matters.)

On this one, I agree with you.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Boszormenyi Zoltan
Дата:
Сообщение: Re: [PATCH] lock_timeout and common SIGALRM framework
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [PATCH 04/16] Add embedded list interface (header only)