Re: pgsql: Fix pg_size_bytes() to be more portable. - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Fix pg_size_bytes() to be more portable.
Date
Msg-id 21899.1455990079@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Fix pg_size_bytes() to be more portable.  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-committers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On 20 February 2016 at 17:24, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>> It looks to me as though it doesn't need long long anyway, since the
>> rotation it's doing can be done just as easily with ints, for example:

> Oh, scratch that -- I was assuming int would be 32-bit, which it might not be.

There's quite a lot of our code that does assume "int" is 32 bits.
(It would be better to write int32 where it matters, but I really doubt
we've been completely consistent about that.)  It probably isn't worth
worrying about; I think the platforms where "int" means int16 are all dead
and buried, or at least far too underpowered to run modern Postgres.
At some point we might have to contend with "int" meaning int64, but
I haven't heard of any such platforms yet.  The real issue is with
"long" and "long long", which definitely do vary in width across supported
platforms.

            regards, tom lane


pgsql-committers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: pgsql: Fix pg_size_bytes() to be more portable.
Next
From: Tatsuo Ishii
Date:
Subject: pgsql: Fix wording in the Tutorial document.