C23 (C standard revision)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 2601:443:481:1020:54a0:de0b:59f:6a0c (talk) at 05:40, 26 September 2022 (C spec. uses "literal" for string and compound literals, not for constants.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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, with extended binary floating-point arithmetic and (optional) decimal floating-point arithmetic
  • Single-argument _Static_assert
  • C++11 style attribute syntax and the nodiscard, maybe_unused, deprecated, and fallthrough attributes
  • memccpy(), strdup(), strndup() – similar to functions found in the POSIX and SVID C extensions
  • Two's complement signed integer 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 constants 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 unsigned _BitInt(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 which are automatic variables allocated 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[7]
  • A memset_explicit() function for erasing sensitive data
  • #embed for binary resource inclusion
  • #warning
  • A nullptr constant and the associated nullptr_t type[8]
  • Pragmas for rounding direction: STDC FENV_ROUND and STDC FENV_DEC_ROUND
  • Library support for UTF-8

Support

The GCC 9,[9] Clang 9.0,[10] and Pelles C 11.00[11] compilers implement an experimental compiler flag to support this standard.

Obsolete features

Some old obsolete features are either removed or deprecated.

Removed
  • Removal of K&R function definitions
  • Representations for signed integers other than two's complement


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. ^ Gustedt, Jens (2022-02-16). "Make false and true first-class language features v8" (PDF). Retrieved 2022-05-26.
  8. ^ Gustedt, Jens; Meneide, JeanHeyd (2022-07-22). "Introduce the nullptr constant". Retrieved 2022-09-01.
  9. ^ "GCC 9 Changes". GCC 9 Release Notes.
  10. ^ "Add a new language mode for C2x". LLVM Project Repository.
  11. ^ "major changes between 10.00 and 11.00".

External links

Preceded by C language standards Latest