KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have been reading that some compilers support va_list with macros and users were able to overload the functionality with other macros in order to count the va_list . With visual studio, is there a way to determine if the va_list is empty (aka count==0)? Basically I would like to know this condition: extern void Foo(const char* psz, ...); void Test() { Foo("My String"); // No params were passed } My initial thought was to do something like this: va_list vaStart; va_list vaEnd; va_start(vaStart, psz); va_end(vaEnd); if (vaStart == vaEnd) ... The problem is that va_end only sets the param to null. #define _crt_va_start(ap,v) ( ap = (va_list)_ADDRESSOF(v) + _INTSIZEOF(v) ) #define _crt_va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) #define _crt_va_end(ap) ( ap = (va_list)0 ) I was thinking of maybe incorporating a terminator but I would want it to be hidden from the caller so that existing code doesnt need to be changed.
Tags (comma-separated)
Save Edits
Cancel