title: Using define directive to get the namespace name
body: <p>Having such a simple C++ code:</p>
  <pre><code>#include &lt;iostream&gt;
  
  #define NS NS_Static
  #define MAKESTRING(x) #x
  
  namespace NS {
    int global_x = 8;
    void print_global_x() {
      std::cout &lt;&lt; MAKESTRING(NS) &lt;&lt; &quot;::global_x: &quot; &lt;&lt; global_x &lt;&lt; std::endl;
    }
  }
  </code></pre>
  <p>I'h expected to get on output <code>NS_Static::global_x: 8</code> BUT getting just <code>NS::global_x: 8</code>. I've asked a similar question earlier and the user <em>Eljay</em> provided me an answer to use such an extra code:</p>
  <pre><code>#define NS Static
  #define MAKESTRING_HELPER(x) #x
  #define MAKESTRING(x) MAKESTRING_HELPER(x)
  </code></pre>
  <p>It finally works but can someone please explain my why my original approach doesn't work?</p>
  <p>Shouldn't the preprocessor (in my original approach) AT FIRST (since it's the first macro defined) run <code>NS NS_Static</code> macro resulting in
  <code>NS_Static</code> and then pass that <code>NS_Static</code> to the stringizing <code>MAKESTRING(x) #x</code> macro resulting in expected <code>NS_Static</code> <em>string</em>?</p>