title: Why do two functions have the same address?
body: <p>Consider this function template:</p>
  
  <pre><code>template&lt;typename T&gt;
  unsigned long f(void *) { return 0;}
  </code></pre>
  
  <p>Now, I print the addresses of <code>f&lt;A&gt;</code> and <code>f&lt;B&gt;</code> as:</p>
  
  <pre><code>std::cout &lt;&lt; (void*)f&lt;A&gt; &lt;&lt; std::endl;
  std::cout &lt;&lt; (void*)f&lt;B&gt; &lt;&lt; std::endl;
  </code></pre>
  
  <p>Why do they print the same address if compiled in MSVS10? Are they not two different functions and therefore should print different addresses? </p>
  
  <p><strong>Updated:</strong></p>
  
  <p>I realized that on ideone, it prints the different address.  MSVS10 optimizes the code, as the function doesn't depend on <code>T</code> in any way, so it produces same function. @Mark's answer and comments on this are valuable. :-)</p>