title: Why is the sum of an int and a float an int?
body: <p>Consider the following code:</p>
  
  <pre><code>float d  = 3.14f;
  int   i  = 1;
  auto sum = d + i;
  </code></pre>
  
  <p>According to <a href="http://en.cppreference.com/w/c/language/conversion" rel="noreferrer">cppreference.com</a>, <code>i</code> should be converted to <code>float</code> when it is added to <code>d</code>. However, when I actually run the code, I find that <code>sum</code> is 4. Why does this happen?</p>
  
  <p>Interestingly, when I explicitly put my compiler into C11 mode, I found that <code>sum</code> was 4.14. What rules does the C11 standard change that affect the outcome?</p>
  
  <p>What would happen if I compiled the same code using a C++ compiler?</p>