title: C++ casting bool to int - standard
body: <p>I am interrested wheather standard says anything about possible values of <code>bool</code> type type after casting it to <code>integer</code> type.</p>
  
  <p>For example following code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main() {
      bool someValue=false;
      *((int*)(&amp;someValue)) = 50;
  
      cout &lt;&lt; someValue &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>prints 1 even though it's forced to store value 50. Does standard specify anything about it? Or is compiler generating some method for type bool as:</p>
  
  <pre><code>operator int(){
      return myValue !=0 ? 1 : 0;
  }
  </code></pre>
  
  <p>Also why is casting like following:</p>
  
  <pre><code>reinterpret_cast&lt;int&gt;(someValue) = 50;
  </code></pre>
  
  <p>forbidden with error </p>
  
  <blockquote>
    <p>error: invalid cast from type 'bool' to type 'int'</p>
  </blockquote>
  
  <p>(For all above I user GCC 5.1 compiler.)</p>