C1X going forward

Iain Buclaw ibuclaw at ubuntu.com
Mon May 9 00:02:03 PDT 2011


== Quote from bearophile (bearophileHUGS at lycos.com)'s article
> D is somewhat backwards compatible with C, you are also able to use the C std
library too. But what C? C89, C99 or C1X? GCC 4.6 introduces some features of C1X.
Some info about the upcoming standard:
> http://en.wikipedia.org/wiki/C1X
> In C1X there is _Noreturn, it seems interesting:
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1453.htm
> In C++0x it's [[noreturn]], and the nonstandard GCC extension is
__attribute__((noreturn)).
> There are also the gets_s() function that replaces gets(), and aligned_alloc().
> Bye,
> bearophile

_Generic is a somewhat interesting feature of C1X too, though I can't imagine ever
using any of the new features they've proposed.

#define sqrt(X) _Generic((X), long double: sqrtl, \
                              default: sqrt, \
                              float: sqrtf)(X)

float a = 25;
auto b = sqrt(a);   // calls sqrtf



Oh, and they've also introduced a _Static_Assert keyword too. :)


More information about the Digitalmars-d mailing list