use of int4/int32 in C code

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: use of int4/int32 in C code
Date: 2012-06-19 11:46:18
Message-ID: 1340106378.26286.25.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

What is the latest theory on using int4 vs. int32 in C code?

(equivalently int2, int16)

I had the idea that using int4 was sort of deprecated, and most code
uses int32, but I've come across several uses of int4 lately that looked
odd to me.

I think the main reason that we define int4 in C is for the
src/include/catalog/ files, but that won't work anymore if we ever want
to have an int8 column there.

Ideas:

* Leave it be.

* Replace int4 by int32 everywhere except in the catalog files. Hope it
stays that way.

* Mark int4 as deprecated, change catalog files to use int32, adjust the
bki generation scripts. (I think removing int4 might not be wise, as
external modules might be using it.)

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?
These are well established by now and would help modernize our code and
the code of extensions a bit.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-06-19 13:33:57 Re: Testing 9.2 in ~production environment
Previous Message Dickson S. Guedes 2012-06-19 11:40:30 Re: pgsql_fdw in contrib