C2x

C2x is an informal name for the next (after C17) major C language standard revision.[1][2] It is expected to be voted on in 2023 and would therefore be C23.[3]

Features

Changes integrated into the latest working draft are:

  • Support for the ISO/IEC 60559:2020, the current version of the IEEE 754 standard for floating-point arithmetic.
  • Single-argument _Static_assert
  • C++11 style attribute syntax and the nodiscard, maybe_unused, deprecated, and fallthrough attributes
  • Extended binary floating-point arithmetic, decimal floating-point arithmetic
  • memccpy(), strdup(), strndup() – similar to functions found in the POSIX and SVID C extensions
  • Two’s complement sign representation is required
  • Removal of K&R function definitions
  • Labels can appear before declarations and at the end of compound statements
  • Unnamed parameters in function definitions[4]
  • Binary literals such as 0b10101010, and %b conversion specifier for printf() function family
  • Better support for using const with arrays[5]
  • Type generic functions for performing checked integer arithmetic (Integer overflow)
  • _BitInt(N) and UnsignedBitInt(N) types for bit-precise integers
  • #elifdef and #elifndef
  • Digit separators: 0xFF'FF'FF'FF
  • Standardization of the typeof(...) (typeof) operator[6]
  • Variably-modified types (but not VLAs on the stack) become a mandatory feature
  • Zero initialization with {} (including initialization of VLAs)
  • alignas, alignof, bool, true, false, static_assert, thread_local become keywords

Support

The GCC 9,[7] Clang 9.0,[8] and Pelles C 11.00[9] compilers implement a compiler flag to support this standard.

References

  1. "History of C". cppreference.
  2. Keaton, David (2016-09-19). "WG 14 N 2086 -- C2x Charter". www.open-std.org. Retrieved 2021-01-03.
  3. "Revised C23 Schedule WG 14 N 2759" (PDF). www.open-std.org. Retrieved 2021-06-19.
  4. "Proposal for C2x WG14 N2480" (PDF). www.open-std.org.
  5. "C2x Proposal: WG14 N2607" (PDF). www.open-std.org.
  6. Meneide, JeanHeyd (2022-01-01). "Not-So-Magic - typeof(…) in C". Retrieved 2022-03-25.
  7. "GCC 9 Changes". GCC 9 Release Notes.
  8. "Add a new language mode for C2x". LLVM Project Repository.
  9. "major changes between 10.00 and 11.00".
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.