Boolean_conversions Using reinterpret_cast<>
<p>Can any one Give the example for </p>

<pre><code> Boolean_conversions Using  reinterpret_cast&lt;&gt;
</code></pre>

<p>Iam getting the execution failure..Any one explain ..</p>

<p>Ex:</p>

<pre><code>   void Boolean_Conversions()
     {
         bool b = 0;
         int *i = reinterpret_cast&lt;int*&gt; (&amp;b);
  // iam expecting as *i is 0/false    ,but it is showing runtime error          
     }
</code></pre>

<p>Edit:
In ISO Standard
Section $5.2.10, para 1:</p>

<pre><code>      "The result of the expression reinterpret_cast&lt;T&gt;(v) is the
  result of converting the expression v to type T. If T is a
  reference type, the result is an lvalue; otherwise, the re
  sult is an rvalue and the l-value to r-value (4.1), array
  to pointer (4.2), and function to pointer (4.3) standard c
  onversions are performed on the the expression v. Types sh
  all not be defined in a reinterpret_cast."
</code></pre>

<p>From this Iam trying ..I did many conversions ..like Array_to_Pointer,Function_To_Pointer,Integral/Pointer_Conversions ,etc...But i don't know why it is failing For Boolean Conversions.</p>

<p>Can any one tell why it is failing ..Otherwise Tell the Boolean COnversions using  reinterpret_cast.</p>

<p>Mostly It is Giving Run time failure in G++.CC/EDG/COdepad..etc compilers</p>

<p>Please Explain</p>
