My code contains snippets like these:
std::va_list ap;
va_start(ap, msgfmt);
snprintf_buf buf;
const tchar * msg = buf.print_va_list(msgfmt, ap);
va_end(ap);
These are short and va_start()
and va_end()
are close together so they are not much of a problem. Exceptions from calls in between the two could be a problem (or not?).
Simple test shows that calling va_start()
from a function without ellipsis is not allowed. Is calling va_end()
from a different function than va_start()
was called from allowed or not?
Basically, I am curious if it is possible to use the SBRM/RAII idiom for these calls, even if it were necessary to call va_start()
manually and then to pass instance of std::va_list
into my RAII/SBRM guard instance?