Re: [pgsql-hackers-win32] snprintf causes regression

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: pgsql(at)mohawksoft(dot)com
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nicolai Tufar <ntufar(at)gmail(dot)com>, Magnus Hagander <mha(at)sollentuna(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Win32 port list <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [pgsql-hackers-win32] snprintf causes regression
Date: 2005-03-11 17:14:26
Message-ID: 200503111714.j2BHEQh10837@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

pgsql(at)mohawksoft(dot)com wrote:
> > Tom Lane wrote:
> >> pgsql(at)mohawksoft(dot)com writes:
> >> >>> Please see my posting about using a macro for snprintf.
> >>
> >> > Wasn't the issue about odd behavior of the Win32 linker choosing the
> >> wrong
> >> > vnsprintf?
> >>
> >> You're right, the point about the macro was to avoid linker weirdness on
> >> Windows. We need to do that part in any case. I think Bruce confused
> >> that issue with the one about whether our version supported %n$
> >> adequately ... which it doesn't just yet ...
> >
> > Perhaps I am reading old email in this reply but I thought I should
> > clarify:
> >
> > Once we do:
> >
> > #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
> > #define snprintf(...) pg_snprintf(__VA_ARGS__)
> > #define printf(...) pg_printf(__VA_ARGS__)
>
>
> I'm not sure that macros can have variable number of arguments on all
> supported platforms. I've been burnt by this before.

The actual patch is:

+ #ifdef __GNUC__
+ #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
+ #define snprintf(...) pg_snprintf(__VA_ARGS__)
+ #define printf(...) pg_printf(__VA_ARGS__)
+ #else
+ #define vsnprintf pg_vsnprintf
+ #define snprintf pg_snprintf
+ #define printf pg_printf
+ #endif

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-03-11 17:18:34 Re: TODO item: support triggers on columns
Previous Message Alvaro Herrera 2005-03-11 17:12:03 Re: TODO item: support triggers on columns

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2005-03-11 17:23:36 Re: [pgsql-hackers-win32] snprintf causes regression
Previous Message pgsql 2005-03-11 17:02:29 Re: [pgsql-hackers-win32] snprintf causes regression

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-03-11 17:23:36 Re: [pgsql-hackers-win32] snprintf causes regression
Previous Message pgsql 2005-03-11 17:02:29 Re: [pgsql-hackers-win32] snprintf causes regression