title: Static variables inside macros
body: <p>I'm looking at some code and think the whole logic doesn't make sense here. It seem quite poor to have a macro like this. 
  As an example, I use this macro twice and I get both strings to output. </p>
  
  <pre><code>TESTING("hello");
  TESTING("world");
  </code></pre>
  
  <ol>
  <li><p>The preprocessor simply replaces the identifier with the block of code, it is the same as copy/pasting the code, so shouldn't the compiler give a redefinition error for firstPass, if using this macro multiple times? (If you manually paste in <code>main</code>, <code>static bool firstPass = true;</code> multiple times, the compiler will give an error.) </p></li>
  <li><p>If <code>firstPass</code> is <code>static</code>, it is created and initialized only once. So using this macro multiple times, shouldn't produce any results (besides the first use) since the flag was set to <code>false</code>, yet it still does <code>cout</code> every time. </p></li>
  </ol>
  
  <p>A bit confused. </p>
  
  <pre><code>#define TESTING(input)                           \
  {                                                \
     static bool firstPass = true;                 \
     if (firstPass) {                              \
       std::cout &lt;&lt; input;                         \
       firstPass = false;                          \
     }                                             \
  }
  </code></pre>