title: Preprocessor: Concatenate string to each argument in __VA_ARGS__
body: <p>I'd like to append a stringified macro argument to each element in a variadic macro. I think I know what I need, but I couldn't come up with a working solution just yet. Given a variadic macro like:</p>
  
  <pre><code>#define FIELD_DECLARATION(NAME, OTHER_FIELD, ...)
  
  FIELD_DECLARATION(First, Thing)
  FIELD_DECLARATION(Second, Thing, Thing, Nothing)
  </code></pre>
  
  <p>I'd like to generate:</p>
  
  <pre><code>field_First = {ThingArg};
  field_Second = {ThingArg, ThingArg, NothingArg};
  </code></pre>
  
  <p>I guess what I need is to recursively keep expanding <code>__VA_ARGS__</code> until it reaches no elements, and append <code>"Arg"</code> while doing expansion. Finally, pass the result to another variadic macro that produces a comma-separated-list of arguments.</p>
  
  <p>I've tried this, which wouldn't work (and it isn't what I described, either):</p>
  
  <pre><code>#define UNPACK_VA_1(A1) A1 ## Arg
  #define UNPACK_VA_2(A1, A2) UNPACK_VA_1(A1), UNPACK_VA_1(A2)
  #define UNPACK_VA_3(A1, A2, A3) UNPACK_VA_2(A1, A2), UNPACK_VA_1(A3)
  #define UNPACK_VA_4(A1, A2, A3, A4) UNPACK_VA_2(A1, A2), UNPACK_VA_2(A3, A4)
  #define UNPACK_VA(...) UNPACK_VA_4(__VA_ARGS__)
  
  #define FOO(x, y, ...) UNPACK_VA(__VA_ARGS__)
  FOO(One, Two, Three, Four, Five, Six)
  </code></pre>
  
  <p>While this somewhat works, I couldn't come up with a scalable solution. It'd be great if someone could shed a light.</p>