digitalmars.D - C1X going forward
- bearophile (8/8) May 08 2011 D is somewhat backwards compatible with C, you are also able to use the ...
- Iain Buclaw (12/20) May 09 2011 library too. But what C? C89, C99 or C1X? GCC 4.6 introduces some featur...
- Nick Sabalausky (3/27) May 09 2011 It's like they're turning C++ into a really, really ugly D :)
- Russel Winder (14/15) May 09 2011 They talking about C not C++ -- C++0x is a start on the path to turning
- Walter Bright (3/10) May 09 2011 This cure is worse than the disease.
- bearophile (5/8) May 09 2011 Ignore _Generic(), but take a look at _Noreturn, gets_s() and aligned_al...
- Walter Bright (2/4) May 09 2011 Those are trivialities; not worth bothering amending the standard for.
- Paulo Pinto (10/22) May 09 2011 Do the new C standards still matter?
- bearophile (11/20) May 09 2011 Lately I compile C code with GCC and Clang. In Clang you don't even need...
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
May 08 2011
== Quote from bearophile (bearophileHUGS lycos.com)'s articleD is somewhat backwards compatible with C, you are also able to use the C stdlibrary 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. :)
May 09 2011
"Iain Buclaw" <ibuclaw ubuntu.com> wrote in message news:iq83hb$139t$1 digitalmars.com...== Quote from bearophile (bearophileHUGS lycos.com)'s articleIt's like they're turning C++ into a really, really ugly D :)D is somewhat backwards compatible with C, you are also able to use the C stdlibrary 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. :)
May 09 2011
On Mon, 2011-05-09 at 14:29 -0400, Nick Sabalausky wrote: [ . . . ]It's like they're turning C++ into a really, really ugly D :)They talking about C not C++ -- C++0x is a start on the path to turning C++ into a beautiful language ;-) --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
May 09 2011
On 5/9/2011 12:02 AM, Iain Buclaw wrote:_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 sqrtfThis cure is worse than the disease. Either put in real overloading, or not. Not this.
May 09 2011
Walter:This cure is worse than the disease. Either put in real overloading, or not. Not this.Ignore _Generic(), but take a look at _Noreturn, gets_s() and aligned_alloc(). http://en.wikipedia.org/wiki/C1X Bye, bearophile
May 09 2011
On 5/9/2011 3:36 PM, bearophile wrote:take a look at _Noreturn, gets_s() and aligned_alloc(). http://en.wikipedia.org/wiki/C1XThose are trivialities; not worth bothering amending the standard for.
May 09 2011
Do the new C standards still matter? Most commercial C compilers are only C89 compliant, with a few C99 features on top, if any. It seems that C89 is good enough for the tasks people still use C for, otherwise other languages are used and as such the new features are not compeling to sell new compilers. -- Paulo "bearophile" <bearophileHUGS lycos.com> wrote in message news:iq7ahc$2ud8$1 digitalmars.com...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
May 09 2011
Paulo Pinto:Do the new C standards still matter?I don't know.Most commercial C compilers are only C89 compliant, with a few C99 features on top, if any.Lately I compile C code with GCC and Clang. In Clang you don't even need a compiler switch to use C99, this is right.It seems that C89 is good enough for the tasks people still use C for, otherwise other languages are used and as such the new features are not compeling to sell new compilers.The adoption range is indeed slow. CPython sources are C89, and most large C projects I've seen don't use *all* C99 features, but this normal. I use C99 because is more handy and safer (example: local declaration of loop variables avoids a good amount of bugs). ----------------------- Iain Buclaw:_Generic is a somewhat interesting feature of C1X too, though I can't imagine ever using any of the new features they've proposed._Generic looks a bit weird, it's meant to improve the usage for library code. I will probably use aligned_alloc(), alignment specifications. And once in a while _Noreturn. The Unicode support, anonymous structures and unions, and the static assertions that I use in D too.Oh, and they've also introduced a _Static_Assert keyword too. :)This is useful, if well implemented. Bye, bearophile
May 09 2011