First, there's no portable way to compute the length of va_list
. Perhaps there's a way to do this in debug (not optimized) configuration of Visual C++?
Specifically I have a variadic function:
void MyVariadic( const char* format, ... )
{
}
(and I cannot change the signature) and I want to detect cases where format
contains percentage characters and the arguments list is empty (which likely means that someone passed a whatever string directly in place of format
instead of using %s
) and once I detect such cases I can assert()
or something.
Is there a way to do this in debug non-optimized build in Visual C++?