title: Throw int to show that only the double catch handler executes... Why does this double handler catch an int?
body: <p>I have this code here:</p>
  <pre><code>int main()
  {
     try // throw int
     {
        int a = 7;
        double b = 9.9;
  
        // throw int to show that only the double catch handler executes
        throw a &lt; b ? a : b;
     } // end try
     catch ( int x ) // catch ints
     {
        cerr &lt;&lt; &quot;The int value &quot; &lt;&lt; x &lt;&lt; &quot; was thrown\n&quot;;
     } // end catch
     catch ( double y ) // catch doubles
     {
        cerr &lt;&lt; &quot;The double value &quot; &lt;&lt; y &lt;&lt; &quot; was thrown\n&quot;;
     } // end catch
  } // end main
  </code></pre>
  <p>The output yields:</p>
  <pre><code>The double value 7 was thrown 
  </code></pre>
  <p>I am trying to understand why the int (a=7) was caught by the double handler.</p>
  <p>In other words, why wasn't the int handler executed, even though it comes before the double handler?</p>
  <p>Could it be due to some implicit conversion? If so, I'm not quite sure how the conditionals (a and b) are involved.</p>
  <p>Any help would be grateful. Thanks!</p>