title: C preprocessor for-loop
body: <p>I am new to the preprocessor, I rarely use it, so this question might seem silly. In my <strong>C</strong> program I discovered that a for loop which had a fixed start and end known at compile time was causing some performance issues. I temporarily solved this by manually rolling it out, however that seems to be a bit dirty. Is there a way to tell the preprocessor to turn this:</p>
  
  <pre><code>for(int i = 0; i &lt; 8; i++)
  {
      doSomeThingWithI(i, [...]);
      doSomeMoreStuffWithIt(i, [...]);
      foo();
      [...]
  }
  </code></pre>
  
  <p>into this:</p>
  
  <pre><code>doSomeThingWithI(0, [...]);
  doSomeMoreStuffWithIt(0, [...]);
  foo();
  [...]
  
  doSomeThingWithI(1, [...]);
  doSomeMoreStuffWithIt(1, [...]);
  foo();
  [...]
  
  [...]
  </code></pre>
  
  <p>The important thing is that I have to use "i" inside the loop.</p>