I think you can safely use va_list without copy on Windows. va_copy is available in Visual Studio 2013 as part of support for C99, previous versions don't have it.
On Tue, Oct 15, 2013 at 2:18 AM, Peter Eisentraut <peter_e@gmx.net> wrote: > On Mon, 2013-10-14 at 23:08 +1300, David Rowley wrote: > >> >> Looks like something like: >> >> >> #ifndef WIN32 >> #define HAVE_VA_COPY 1 >> #endif >> >> >> would need to be added to asprintf.c, but also some work needs to be >> done with mcxt.c as it uses va_copy unconditionally. Perhaps just >> defining a macro for va_copy would be better for windows. I was not >> quite sure the best header file for such a macro so I did not write a >> patch to fix it. > > Does Windows not have va_copy? What do they use instead?
No, Windows doesn't have va_copy, instead they use something like below: #define va_copy(dest, src) (dest = src)
I think rather than having writing code like above at places where va_copy is used, we can use something like: #ifdef WIN32 #define va_copy(dest, src) (dest = src) #endif
and define HAVE_VA_COPY to 1 for non-windows platform.