title: Is it possible to iterate over arguments in variadic macros?
body: <p>I was wondering if it is possible to iterate over arguments passed to a variadic macro in C99 or using any GCC extensions ?</p>
  
  <p>For e.g. is it possible to write a generic macro that takes a structure and its fields passed as arguments and prints offset of each field within the structure ?</p>
  
  <p>Something like this:</p>
  
  <pre>
  struct a {
      int a;
      int b;
      int c;
  };
  
  /* PRN_STRUCT_OFFSETS will print offset of each of the fields 
     within structure passed as the first argument.
  */
  
  int main(int argc, char *argv[])
  {
      PRN_STRUCT_OFFSETS(struct a, a, b, c);
  
      return 0;
  }
  </pre>