title: Why can I use a function to assign a value to a constant?
body: <p>Why is the following code allowed in C++ when PI is a constant and determined at compile time while 4*atan(1) is only determined at runtime.</p>
  
  <pre><code>int main(){
      const double PI = 4*atan(1);
      std::cout &lt;&lt; PI &lt;&lt; std::endl;
      return 0; 
  }
  </code></pre>
  
  <p>Where have I got it wrong?</p>