Merlin Moncure wrote:
On Dec 5, 2007 2:44 PM, Alvaro Herrera <[EMAIL PROTECTED]> 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
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

we don't use variadic macros...just a macro wrapper to a variadic function.


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive 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.


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to