use of int4/int32 in C code - Mailing list pgsql-hackers

From Peter Eisentraut
Subject use of int4/int32 in C code
Date
Msg-id 1340106378.26286.25.camel@vanquo.pezone.net
Whole thread Raw
Responses Re: use of int4/int32 in C code  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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.




pgsql-hackers by date:

Previous
From: "Dickson S. Guedes"
Date:
Subject: Re: pgsql_fdw in contrib
Next
From: Tom Lane
Date:
Subject: Re: Testing 9.2 in ~production environment