Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do any c compilers implement any of the C1X features?

Do any c compilers implement any of the C1X features?

P.S.:Is there a way to emulate some of these features in current c compilers

like image 796
Roman A. Taycher Avatar asked Sep 01 '11 09:09

Roman A. Taycher


3 Answers

GCC 4.6 has some experimental support for C1X features:

There is now experimental support for some features from the upcoming C1X revision of the ISO C standard. This support may be selected with -std=c1x, or -std=gnu1x for C1X with GNU extensions. Note that this support is experimental and may change incompatibly in future releases for consistency with changes to the C1X standard draft. The following features are newly supported as described in the N1539 draft of C1X (with changes agreed at the March 2011 WG14 meeting); some other features were already supported with no compiler changes being needed, or have some support but not in full accord with N1539 (as amended).

  • Static assertions (_Static_assert keyword)
  • Typedef redefinition
  • New macros in <float.h>
  • Anonymous structures and unions
like image 66
Justin Avatar answered Nov 13 '22 09:11

Justin


Besides gcc, clang has started to add support for C1x features. In particular, there is support for _Generic and _Static_assert. Some other features may be implemented as well, but I haven't tried them.

like image 42
Stephen Canon Avatar answered Nov 13 '22 09:11

Stephen Canon


Based on perusal of the lists and the gcc testsuite (ls gcc/gcc/testsuite/gcc.dg/c1x*):

  • I looks like _Noreturn is coming in gcc-4.7.
  • From the testsuite it looks like unicode strings will be too.
  • It also looks like CMPLX macros are being worked on too.
  • Maybe _Generic is coming in gcc-4.8.
like image 3
emsr Avatar answered Nov 13 '22 07:11

emsr