![C23 (C standard revision) C23 (C standard revision)](/modules/owlapps_apps/img/nopic.jpg)
C23 is the informal name for ISO/IEC 9899:2024, the next standard for the C programming language, which will replace C17 (standard ISO/IEC 9899:2018). It was started in 2016 informally as C2x, and expected to be published in 2024. The most recent publicly available working draft of C23 was released on April 1, 2023. The first WG14 meeting for the C2x draft was held in October 2019, virtual remote meetings were held in 2020 due to the COVID-19 pandemic, then various teleconference meetings continued to occur through 2024.
Changes integrated into the latest working draft of C23 are listed below.
memset_explicit()
function in <string.h>
to erase sensitive data, where memory store must always be performed regardless of optimizations.memccpy()
function in <string.h>
to efficiently concatenate strings – similar to POSIX and SVID C extensions.strdup()
and strndup()
functions in <string.h>
to allocate a copy of a string – similar to POSIX and SVID C extensions.memalignment()
function in <stdlib.h>
to determine the byte alignment of a pointer.<stdbit.h>
to examine many integer types. All start with stdc_
to minimize conflict with legacy code and 3rd party libraries.
*
with uc
, us
, ui
, ul
, ull
for five function names, or blank for a type-generic macro.stdc_count_ones*()
and stdc_count_zeros*()
to count number of 1 or 0 bits in value.stdc_leading_ones*()
and stdc_leading_zeros*()
to count leading 1 or 0 bits in value.stdc_trailing_ones*()
and stdc_trailing_zeros*()
to count trailing 1 or 0 bits in value.stdc_first_leading_one*()
and stdc_first_leading_zero*()
to find first leading bit with 1 or 0 in value.stdc_first_trailing_one*()
and stdc_first_trailing_zero*()
to find first trailing bit with 1 or 0 in value.stdc_has_single_bit*()
to determine if value is an exact power of 2 (return true if and only if there is a single 1 bit).stdc_bit_floor*()
to determine the largest integral power of 2 that is not greater than value.stdc_bit_ceil*()
to determine the smallest integral power of 2 that is not less than value.stdc_bit_width*()
to determine number of bits to represent a value.timegm()
function in <time.h>
to convert time structure into calendar time value - similar to function in glibc and musl libraries.<math.h>
functions based on IEEE 754-2019 recommendations, such as trigonometry functions operating on units of and exp10
.%b
binary conversion specifier to printf()
function family.%b
binary conversion specifier to scanf()
function family.0b
and 0B
binary conversion support to strtol()
and wcstol()
function families.bsearch()
, bsearch_s()
, memchr()
, strchr()
, strpbrk()
, strrchr()
, strstr()
, and their wide counterparts wmemchr()
, wcschr()
, wcspbrk()
, wcsrchr()
, wcsstr()
return a const qualified object if one was passed to them.#elifdef
and #elifndef
directives, which are essentially equivalent to #elif defined
and #elif !defined
. Both directives were added to C++23 standard and GCC 12.#embed
directive for binary resource inclusion and __has_embed
allowing the availability of a resource to be checked by preprocessor directives.#warning
directive for diagnostics.__has_include
allowing the availability of a header to be checked by preprocessor directives.__has_c_attribute
allowing the availability of an attribute to be checked by preprocessor directives. (see "C++ compatibility" group for new attribute feature)__VA_OPT__
functional macro for variadic macros which expands to its argument only if a variadic argument has been passed to the containing macro.nullptr_t
, a null pointer type._BitInt(N)
and unsigned _BitInt(N)
types for bit-precise integers. Add BITINT_MAXWIDTH
macro for maximum bit width.ckd_add()
, ckd_sub()
, ckd_mul()
macros for checked integer operations.const
with arrays.typeof(...)
operator.auto
keyword was changed to cause type inference while also retaining its old meaning of a storage class specifier if used alongside a type. Unlike C++, C23 allows type inference only for object definitions (no inferring function return type or function parameter type).intmax_t
(N2888).nullptr
constant for nullptr_t
type.wb
and uwb
integer literal suffixes for _BitInt(N)
and unsigned _BitInt(N)
types, such as 6uwb
yields an unsigned _BitInt(3)
, and -6wb
yields a signed _BitInt(4)
which has three value bits and one sign bit.0b
and 0B
binary literal constant prefixes, such as 0b10101010
(equating to 0xAA).'
digit separator to literal constants, such as 0xFE'DC'BA'98
(equating to 0xFEDCBA98), 299'792'458
(equating to 299792458), 1.414'213'562
(equating to 1.414213562).enum
.enum
s with no fixed underlying type to store values that are not representable by int
.true
and false
keywords.alignas
, alignof
, bool
, static_assert
, thread_local
keywords. Previously defined keywords become alternative spellings: _Alignas
, _Alignof
, _Bool
, _Static_assert
, _Thread_local
._BitInt
keyword (see "types" group)typeof
and typeof_unqual
keywords (see "types" group)nullptr
keyword (see "constants" group)constexpr
keyword (see "other" group)_Decimal32
, _Decimal64
, _Decimal128
keywords for (optional) decimal floating-point arithmetic (see "other" group){}
(including initialization of VLAs).va_start
macro no longer needs a second argument nor does it evaluate any argument after the first one if present.[[]]
._Static_assert
for compatibility with C++17.void foo()
are understood as taking no arguments (see removal of K&R function declarations){}
, variadic functions without named argument, C++11 style attributes, _Static_assert
(see Syntax). For labels at the end of compound statements a corresponding change was made to C++23.[[deprecated]]
, [[fallthrough]]
, [[maybe_unused]]
, [[nodiscard]]
, and [[noreturn]]
attribute for compatibility with C++11, then deprecate _Noreturn
, noreturn
, header <stdnoreturn.h>
features introduced in C11. Duplicate attributes are allowed for compatibility with C++23. All standard attributes can also be surrounded by double underscores (e.g. [[__deprecated__]]
is equivalent to [[deprecated]]
).u8
prefix for character literals to represent UTF-8 encoding for compatibility with C++17.#elifdef
and #elifndef
preprocessing directives for compatibility with C++23. (see "preprocessor" group)constexpr
specifier for objects but not functions, unlike C++'s equivalent.char8_t
type for storing UTF-8 encoded data and change the type of u8 character constants and string literals to char8_t
. Also, the functions mbrtoc8()
and c8rtomb()
to convert a narrow multibyte character to UTF-8 encoding and a single code point from UTF-8 to a narrow multibyte character representation respectively.char16_t
strings and literals shall be UTF-16 encoded, and all char32_t
strings and literals shall be UTF-32 encoded, unless otherwise explicitly specified.Some old obsolete features are either removed or deprecated from the working draft of C23:
*_HAS_SUBNORM
macros in <float.h>
are obsolescent features.The GCC 9, Clang 9.0, and Pelles C 11.00 compilers implement an experimental compiler flag to support this standard.
Owlapps.net - since 2012 - Les chouettes applications du hibou