title: C11 type-generic expressions - why not just add function overloading?
body: <p>I was just reading the Wikipedia article on <a href="http://en.wikipedia.org/wiki/C11_%28C_standard_revision%29" rel="nofollow noreferrer">C11</a>, the new version of the C standard released in Dec 2011, and I saw that one of the added features was "type-generic expressions":</p>
  
  <blockquote>
    <p>Type-generic expressions using the <code>_Generic</code> keyword. For example, the
    following macro <strong>cbrt(x)</strong> translates to <strong>cbrtl(x)</strong>, <strong>cbrt(x)</strong> or <strong>cbrtf(x)</strong>
    depending on the type of <strong>x</strong>:</p>
  
  <pre><code>#define cbrt(X) _Generic((X), long double: cbrtl, \
                                default: cbrt, \
                                float: cbrtf)(X)
  </code></pre>
  </blockquote>
  
  <p>This looks pretty horrible to me - if they are going to change the language anyways, why not just add function overloading like in C++?</p>