J
John Harrison
Is the following code OK?
#include <stdarg.h>
void func(const X& x)
{
va_list args;
va_start(args, x);
funcv(x, args);
va_end(args);
}
void funcv(const X& x, va_list args)
{
// ...
}
In other words is it OK to use va_start on an parameter that is a reference?
I can't see anything that says it isn't, nor can I see why it shouldn't work
from looking at the definition of va_start in my compiler (VC++ 7). But I
get memory access errors in funcv, which only go away when I change the type
of the parameter to func from const X& to X.
john
#include <stdarg.h>
void func(const X& x)
{
va_list args;
va_start(args, x);
funcv(x, args);
va_end(args);
}
void funcv(const X& x, va_list args)
{
// ...
}
In other words is it OK to use va_start on an parameter that is a reference?
I can't see anything that says it isn't, nor can I see why it shouldn't work
from looking at the definition of va_start in my compiler (VC++ 7). But I
get memory access errors in funcv, which only go away when I change the type
of the parameter to func from const X& to X.
john