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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql: Fix pg_size_bytes() to be more portable.
Дата
Msg-id 6029.1455980933@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Fix pg_size_bytes() to be more portable.  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: pgsql: Fix pg_size_bytes() to be more portable.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Dean Rasheed
Дата:
Сообщение: Re: pgsql: Fix pg_size_bytes() to be more portable.
Следующее
От: Dean Rasheed
Дата:
Сообщение: pgsql: Further fixing to make pg_size_bytes() portable.