Re: pgsql: Fix pg_size_bytes() to be more portable.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix pg_size_bytes() to be more portable.
Date: 2016-02-20 15:08:53
Message-ID: 6029.1455980933@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> On 20 February 2016 at 14:54, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Dean Rasheed 2016-02-20 15:51:40 pgsql: Further fixing to make pg_size_bytes() portable.
Previous Message Dean Rasheed 2016-02-20 15:02:40 Re: pgsql: Fix pg_size_bytes() to be more portable.