title: How can I generate a list via the C preprocessor (cpp)?
body: <p>I would like to do something like the following:</p>
  
  <pre><code>F_BEGIN
  
  F(f1) {some code}
  F(f2) {some code}
  ...
  F(fn) {some code}
  
  F_END
  </code></pre>
  
  <p>and have it generate the following</p>
  
  <pre><code>int f1() {some code}
  int f2() {some code}
  ...
  int fn() {some code}
  
  int (*function_table)(void)[] = { f1, f2, ..., fn };
  </code></pre>
  
  <p>The functions themselves are easy.  What I can't seem to do is to keep track of all of the names until the end for the function_table.</p>
  
  <p>I looked at <a href="https://stackoverflow.com/questions/1135822/escaping-a-symbol-in-a-define">this question</a> and <a href="https://stackoverflow.com/questions/1135822/escaping-a-symbol-in-a-define-macro">this question</a> but I couldn't get anything to work for me.
  Any ideas?</p>