title: How to determine if va_list is empty
body: <p>I have been reading that some compilers support va_list with macros and users were able to <a href="https://groups.google.com/forum/?fromgroups#!topic/comp.std.c/d-6Mj5Lko_s" rel="nofollow noreferrer">overload the functionality with other macros in order to count the va_list</a>.</p>
  
  <p>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:</p>
  
  <pre><code>extern void Foo(const char* psz, ...);
  void Test()
  {
    Foo("My String"); // No params were passed
  }
  </code></pre>
  
  <p>My initial thought was to do something like this:</p>
  
  <pre><code>va_list vaStart;
  va_list vaEnd;
  va_start(vaStart, psz);
  va_end(vaEnd);
  if (vaStart == vaEnd) ...
  </code></pre>
  
  <p>The problem is that va_end only sets the param to null. </p>
  
  <pre><code>#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 )
  </code></pre>
  
  <p>I was thinking of maybe incorporating a <a href="https://stackoverflow.com/questions/4800641/how-to-loop-through-a-va-list-if-the-number-of-arguments-is-unknown">terminator</a> but I would want it to be hidden from the caller so that existing code doesnt need to be changed.</p>