Re: snprintf causes regression tests to fail

From: pgsql(at)mohawksoft(dot)com
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Nicolai Tufar" <ntufar(at)gmail(dot)com>, "Magnus Hagander" <mha(at)sollentuna(dot)net>, pgsql-hackers(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: snprintf causes regression tests to fail
Date: 2005-03-02 12:09:37
Message-ID: 16751.24.91.171.78.1109765377.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

>
> The big question is why our own vsnprintf() is not being called from
> snprintf() in our port file.
>

I have seen this "problem" before, well, it isn't really a problem I guess.

I'm not sure of the gcc compiler options, but....

On the Microsoft compiler if you specify the option "/Gy" it separates the
functions within the object file, that way you don't load all the
functions from the object if they are not needed.

If, however, you create a function with the same name as another function,
and one is declared in an object compiled with the "/Gy" option, and the
other's object file is not, then if you also use a different function or
reference variable in the object file compiled without the "/Gy" option,
then the conflicting function will probably be used. Make sense?

I would suggest using macro to redefine snprintf and vnsprintf to avoid
the issue:

#define snprintf pg_snprintf
#define vnsprintf pg_vnsprintf

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-03-02 13:31:11 Re: [HACKERS] UTF8 or Unicode
Previous Message Bernd Helmle 2005-03-02 11:47:02 Re: [HACKERS] Development Plans

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Bruce Momjian 2005-03-02 15:41:00 Re: [pgsql-hackers-win32] snprintf causes regression tests
Previous Message Nicolai Tufar 2005-03-02 09:13:19 Re: [pgsql-hackers-win32] snprintf causes regression tests to fail

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-03-02 13:31:11 Re: [HACKERS] UTF8 or Unicode
Previous Message Magnus Hagander 2005-03-02 10:30:38 Re: [pgsql-hackers-win32] [HACKERS] snprintf causes regression tests to fail