I was just reading the Wikipedia article on C11, the new version of the C standard released in Dec 2011, and I saw that one of the added features was "type-generic expressions":

Type-generic expressions using the _Generic keyword. For example, the following macro cbrt(x) translates to cbrtl(x), cbrt(x) or cbrtf(x) depending on the type of x:

#define cbrt(X) _Generic((X), long double: cbrtl, \
                              default: cbrt, \
                              float: cbrtf)(X)

This looks pretty horrible to me - if they are going to change the language anyways, why not just add function overloading like in C++?

Edit
Report