Re: [PATCHES] snprintf() argument reordering not working - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: [PATCHES] snprintf() argument reordering not working
Date
Msg-id 439314CC.6090400@dunslane.net
Whole thread Raw
In response to Re: [PATCHES] snprintf() argument reordering not working under  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [PATCHES] snprintf() argument reordering not working
Re: [PATCHES] snprintf() argument reordering not working under Windows in 8.1
List pgsql-hackers

Bruce Momjian wrote:

>OK, here is what happened.  In March 2005, we got reports of compile
>problems on Win32 using NLS:
>
>    http://archives.postgresql.org/pgsql-hackers/2005-03/msg00710.php
>
>(See the quoted text under the posted text as well.)  Basically,
>libintl.h on Win32 replaces *printf calls with its own versions, and
>does it using macros, _just_ like we do.  This of course causes
>conflicts and the system fails to compile.  The _fix_ was to disable
>port/*printf on Win32 when using NLS because NLS wants to use its own
>*printf.  I _assumed_ that libintl.h did this so it could use its own
>routines that understood %$, but never verified that.  It didn't seem we
>had any choice to fix this, and got no problem reports about %$ not
>working until yours.
>
>After over a month with no solution I added the code as you see it now:
>
>    http://archives.postgresql.org/pgsql-hackers-win32/2005-05/msg00011.php
>
>Oh, and it was Andrew Dunstan who worked on this, not Magnus.  (Sorry
>Magnus, Hello Andrew.)
>
>Anyway, I think the big question is, was the pginstaller built with a
>libintl that replaces *printf, and is it an *printf that doesn't
>understand positional parameters, and so, how can we fix it.
>
>  
>

Well , I diagnosed the problem - you're on your own as far as the 
"solution" goes ;-)

On thing that seems clear to me is that we need a way of testing NLS 
support.

Tom said:

>Would it work to modify c.h so that it #include's libintl.h, then #undefs
>these macros, then #includes port.h to define 'em the way we want?
>Some or all of this might need to be #ifdef WIN32, but that seems like
>a reasonably noninvasive solution if it can work.
>

IIRC last time I tried this it didn't work too well ;-( I will have 
another go. I think it's the best way to go.

cheers

andrew


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: generalizing the planner knobs
Next
From: Paul Lindner
Date:
Subject: Re: Upcoming PG re-releases