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 6029.1455980933@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>)
Responses Re: pgsql: Fix pg_size_bytes() to be more portable.
List pgsql-committers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On 20 February 2016 at 14:54, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Project style is to use something like "(uint64) 1024" instead.

> BTW, I found a couple of instances of 'LL' in ecpglib/prepare.c, which
> is why I thought it was OK to use it.

[ squint... ]  Don't know how long that code has been there, but it's
gratuitously unportable.  Even if you grant that "long long" exists
in the compiler, there's no promises whatever as to what width it is.
This code looks to be assuming that it's int64, but just using int64
would be a better answer.

BTW, I now remember that we have an INT64CONST macro in c.h, which
would be another solution if you don't like the cast for some reason.

            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: Dean Rasheed
Date:
Subject: pgsql: Further fixing to make pg_size_bytes() portable.