Re: PQParam version 0.5

Поиск
Список
Период
Сортировка
От Andrew Chernow
Тема Re: PQParam version 0.5
Дата
Msg-id 475703F6.8060309@esilo.com
обсуждение исходный текст
Ответ на Re: PQParam version 0.5  ("Merlin Moncure" <mmoncure@gmail.com>)
Список pgsql-patches
Merlin Moncure wrote:
> On Dec 5, 2007 2:44 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>> Andrew Chernow escribió:
>>
>>> Also changed PQputint8's prototype.  Previously, it was using a void* as
>>> the value argument, due to a lack of a portable 64-bit type in libpq. We
>>> found an intersting way around this by using macro and variable argument
>>> tricks.
>> I didn't read the patch, but variadic macros are not portable.  FWIW
>> uint64 should "portable" to all platforms that have it (and it should be
>> 32 bits on platforms that don't), but you have to watch for
>> INT64_IS_BUSTED.
>
> we don't use variadic macros...just a macro wrapper to a variadic function.
>
> merlin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>
>

Taken from libpq-fe.h

#define PQputint8(conn, i8) PQputint8v(conn, sizeof(i8), i8)
/* Function subject to change. Do not use directly, see PQputint8. */
extern int PQputint8v(PGconn *conn, size_t valsize, ...);

// goal was pass by value, not by ptr, which was our first solution
PQputint8(conn, 12345678912345LL);

The problem is libpq has no public 64-bit data type to use with the
PQputint8 prototype.  But! if we make PQputint8 a macro that wraps a
variadic function, we get around the data type issue.

Since libpq doesn't have a public 64-bit portable data type, we felt
this was done for a good reason.  We didn't want to break that convention.

andrew

В списке pgsql-patches по дате отправления:

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: PQParam version 0.5
Следующее
От: Chris Browne
Дата:
Сообщение: Re: Better default_statistics_target