Re: use of int4/int32 in C code

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: use of int4/int32 in C code
Date: 2012-06-19 19:24:23
Message-ID: CAEYLb_U9C7Raq3G-3E==0a4QJYwMw5vyu9kf0VjyJAQ42ZLDig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19 June 2012 20:11, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Jun 19, 2012 at 9:47 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Peter Eisentraut <peter_e(at)gmx(dot)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.

Yeah. I find pgindent changes annoying when doing a git blame myself.
Now, granted, you can mostly take care of that by having the tool
ignore whitespace changes, but that doesn't always work perfectly, and
I haven't been able to figure out a better way of managing that.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-06-19 19:29:00 Re: Allow WAL information to recover corrupted pg_controldata
Previous Message Andres Freund 2012-06-19 19:18:33 Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node