Print Print
Reading time 4:10

C2x is an informal name for the next (after C17) major C language standard revision.[1] It is not expected to be voted on until December 2021.[2][3]


Among proposed features:

  • single-argument _Static_assert
  • C++11 style attribute syntax[4]
  • extended binary floating-point arithmetic, decimal floating-point arithmetic
  • memccpy(), strdup(), strndup() – similar to functions found in the POSIX and SVID C extensions
  • char8_t type, in the same vein as char16_t and char32_t added in C11 (proposal N2231[5]).
  • add a new principle to the "original principles" of C: "15. Application Programming Interfaces (APIs) should be self-documenting when possible. In particular, the order of parameters in function declarations should be arranged such that the size of an array appears before the array. The purpose is to allow variable-length array (VLA) notation to be used. This not only makes the code's purpose clearer to human readers, but also makes static analysis easier. Any new APIs added to the Standard should take this into consideration."[2]
  • Possibly IEEE 754-2019, with fmaxmag / fminmag removed.[6]
  • Standardization of the typeof(...) operator[7]


The GCC 9[3] and Clang 9.0[4] compilers support the -std=c2x option to support this standard.


  1. ^ "History of C". cppreference.
  2. ^ a b Keaton, David (2016-09-19). "WG 14 N 2086 -- C2x Charter". www.open-std.org. Retrieved 2021-01-03.
  3. ^ a b Larabel, Michael (2018-10-18). "GCC 9 Compiler Adds -std=c2x And -std=gnu2x For Future C Language Update". Phoronix.
  4. ^ a b Larabel, Michael (2019-05-14). "LLVM Clang 9.0 Picks Up Initial C2x Language Mode". Phoronix.
  5. ^ Honermann, Tom (2018-03-25). "Proposal for C2x WG14 N2231. char8_t: A type for UTF-8 characters and strings". Retrieved 2021-02-22.
  6. ^ "Add feature test macro _ISOC2X_SOURCE - Patchwork". patches-gcc.linaro.org. Retrieved 2021-03-02. it's plausible some 18661-1 functions will not end up in C2X; specifically, the changes to minimum / maximum operations in IEEE 754-2019 could result in fmaxmag / fminmag being removed (see<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2273.pdf>)
  7. ^ Meneide, JeanHeyd (2021-03-07). "Not-So-Magic - typeof(…) in C". Retrieved 2021-04-19.

By: Wikipedia.org
Edited: 2021-06-18 15:14:45
Source: Wikipedia.org