
On 12/29/2009 1:45 AM, Gennadiy Rozental wrote:
Eric Niebler<eric<at> boostpro.com> writes:
On 12/28/2009 7:03 AM, Gennadiy Rozental wrote:
What is the proper (portable) way to copy va_list? Or at least what is the workaround for this compiler?
There isn't a portable way to copy a va_list. va_copy is not standard. On some systems it's __va_copy, and other systems (e.g. msvc) don't have it at all. Can the code in question be rewritten to not need it?
I essentially need to do double pas through va_list. I can't reinitialize it cause I am doing this in a function which takes va_list as argument.
As others here have pointed out, va_copy is not standard in C++03, which is the language that most (all?) of Boost's users care about. Boost's guidelines are pretty explicit about non-standard code:
Aim for ISO Standard C++. Than means making effective use of the standard features of the language, and avoiding non-standard compiler extensions. It also means using the C++ Standard Library where applicable.
Of course, it's not always possible to avoid non-standard code. But if there's a way to make just a single pass over the va_list and save the results for later re-use, I think that would be preferable. It would certainly address the portability problems this change has caused. -- Eric Niebler BoostPro Computing http://www.boostpro.com