title: C-preprocessor recursive macro
body: <pre><code>#define PP_ARG0_(arg0, ...) arg0
  #define PP_REST_(arg0, ...) __VA_ARGS__
  #define PP_ARG0(args) PP_ARG0_ args
  #define PP_REST(args) PP_REST_ args
  
  #define FUNCTION(name) void name();
  #define FUNCTION_TABLE(...)                   \
      FUNCTION(PP_ARG0((__VA_ARGS__)))          \
      FUNCTION_TABLE(PP_REST((__VA_ARGS__)))    \
  </code></pre>
  
  <p>test code:</p>
  
  <pre><code>FUNCTION_TABLE(f1, f2,f3,testA,testB,testC);
  </code></pre>
  
  <p>Obviously, because of recursive expansion it will only declare <code>void f1();</code>  and the rest won't be expanded:</p>
  
  <pre><code>void f1(); FUNCTION_TABLE(f2,f3,testA,testB,testC);
  </code></pre>
  
  <p>What kind of trick can I use to achieve recursive expansion in this case? The problem is that I need to support MANY arguments (up 100) and I absolutely cannot use boost.</p>