Namespaces
Variants
Views
Actions

Difference between revisions of "c/23"

From cppreference.com
< c
m (-✅, -❌)
 
(21 intermediate revisions by 11 users not shown)
Line 4: Line 4:
 
The next generation of the C standard.
 
The next generation of the C standard.
  
See: {{stddoc|n2984|The current IS schedule for C23}}.
+
* {{stddoc latest draft|The latest publicly available WD of C23}} ({{stdinfo latest draft docnum}}, {{stdinfo latest draft docdate}}).
 +
* {{stddoc|N3149.zip|The latest WD of C23}} (n3149, 2023-07-09, a password-protected zip archive, see {{stddoc|n3150.htm|n3150}}).
  
{{todo| accepted changes not yet included in the working draft}}
+
{{todo|accepted changes not yet included in the working draft}}
  
== Obsolete ==
+
==Obsolete==
  
 
===Removed===
 
===Removed===
 
* Old-style function [[c/language/function declaration|declarations]] and [[c/language/function definition|definitions]]
 
* Old-style function [[c/language/function declaration|declarations]] and [[c/language/function definition|definitions]]
 
* Representations for [[c/language/arithmetic types|signed integers]] other than two's complement
 
* Representations for [[c/language/arithmetic types|signed integers]] other than two's complement
* Permission that {{c|u}}/{{c|U}}-prefixed [[c/language/character_constant|character constants]] and [[c/language/string_literal|string literals]] may be not UTF-16/32
+
* Permission that {{c|u}}/{{c|U}}-prefixed {{lt|c/language/character constant}}s and {{lt|c/language/string literal}}s may be not UTF-16/32
 
* Mixed wide [[c/language/string literal|string literal]] concatenation
 
* Mixed wide [[c/language/string literal|string literal]] concatenation
 
* Support for calling {{ltf|c/memory/realloc}} with zero size (the behavior becomes undefined)
 
* Support for calling {{ltf|c/memory/realloc}} with zero size (the behavior becomes undefined)
 
* {{ltt|c/types|__alignof_is_defined}} and {{ltt|c/types|__alignas_is_defined}}
 
* {{ltt|c/types|__alignof_is_defined}} and {{ltt|c/types|__alignas_is_defined}}
 +
* {{ltt|c/error/static_assert}} is not provided as a macro defined in {{header|assert.h}} (becomes a keyword)
 +
* {{ltt|c/thread/thread_local}} is not provided as a macro defined in {{header|threads.h}} (becomes a keyword)
  
 
===Deprecated===
 
===Deprecated===
 +
* {{header|stdnoreturn.h}}
 
* Old feature-test macros
 
* Old feature-test macros
 
** {{ltt|c/preprocessor/replace|__STDC_IEC_559__}}
 
** {{ltt|c/preprocessor/replace|__STDC_IEC_559__}}
 
** {{ltt|c/preprocessor/replace|__STDC_IEC_559_COMPLEX__}}
 
** {{ltt|c/preprocessor/replace|__STDC_IEC_559_COMPLEX__}}
* {{ltt|c/types/limits|DECIMAL_DIG}}
+
* {{ltt|c/language/_Noreturn}} function specifier
* Definition of following numeric limit macros in {{tt|<math.h>}} (they should be used via {{tt|<limits.h>}})
+
* {{ltt|c/language/attributes/noreturn|_Noreturn}} attribute token
 +
* {{lc|asctime()}}
 +
* {{lc|ctime()}}
 +
* {{ltt|c/types/limits|DECIMAL_DIG}} (use the appropriate type-specific macro ({{ltt|c/types/limits#Limits of floating-point types|FLT_DECIMAL_DIG}}, etc) instead)
 +
* Definition of following numeric limit macros in {{header|math.h}} (they should be used via {{header|float.h}})
 
** {{ltt|c/numeric/math|INFINITY}}
 
** {{ltt|c/numeric/math|INFINITY}}
 
** {{ltt|c/numeric/math|DEC_INFINITY}}
 
** {{ltt|c/numeric/math|DEC_INFINITY}}
 
** {{ltt|c/numeric/math|NAN}}
 
** {{ltt|c/numeric/math|NAN}}
 
** {{ltt|c/numeric/math|DEC_NAN}}
 
** {{ltt|c/numeric/math|DEC_NAN}}
* {{ltt|c/language/_Noreturn}} function specifier
 
* {{ltt|c/language/attributes/noreturn|_Noreturn}} attribute token
 
 
* {{ltt|c/types|__bool_true_false_are_defined}}
 
* {{ltt|c/types|__bool_true_false_are_defined}}
  
== New language features ==
+
==New language features==
 
* [[c/language/arithmetic types|Decimal floating-point types]] ({{ltt|c/keyword/_Decimal32}}, {{ltt|c/keyword/_Decimal64}}, and {{ltt|c/keyword/_Decimal128}})
 
* [[c/language/arithmetic types|Decimal floating-point types]] ({{ltt|c/keyword/_Decimal32}}, {{ltt|c/keyword/_Decimal64}}, and {{ltt|c/keyword/_Decimal128}})
 +
* [[c/language/arithmetic types|Bit-precise integers]] ({{ltt|c/keyword/_BitInt}})
 
* [[c/language/integer constant|Binary integer constants]]
 
* [[c/language/integer constant|Binary integer constants]]
 
* [[c/language/character constant|{{tt|u8}} character constants]]
 
* [[c/language/character constant|{{tt|u8}} character constants]]
 
* Type change of [[c/language/string literal|{{tt|u8}} string literals]]
 
* Type change of [[c/language/string literal|{{tt|u8}} string literals]]
 
* Digit separator {{tt|'}}
 
* Digit separator {{tt|'}}
* Empty [[c/language/initialization|initializer]] {{c|1== {} }}
+
* Empty [[c/language/initialization|initializer]] {{c|1=={}<!---->}}
 
* [[c/language/attributes|Attributes]]
 
* [[c/language/attributes|Attributes]]
** {{cattr|deprecated}}
+
** {{attr|deprecated}}
** {{cattr|fallthrough}}
+
** {{attr|fallthrough}}
** {{cattr|maybe_unused}}
+
** {{attr|maybe_unused}}
** {{cattr|nodiscard}}
+
** {{attr|nodiscard}}
** {{cattr|noreturn}}
+
** {{attr|noreturn}}
* Unnamed parameters in [[c/language/function definition|function definitions]]
+
** {{attr|reproducible}}
 +
** {{attr|unsequenced}}
 +
* Unnamed parameters in {{lt|c/language/function definition}}s
 
* Identical cvr-qualifications for [[c/language/array|array types]] and their element types
 
* Identical cvr-qualifications for [[c/language/array|array types]] and their element types
 
* Single-argument {{ltt|c/language/_Static_assert}}
 
* Single-argument {{ltt|c/language/_Static_assert}}
 +
* {{ltt|c/keyword/static_assert}} becomes a keyword (may be a predefined macro for compatibility reasons)
 +
* {{ltt|c/keyword/thread_local}} becomes a keyword (may be a predefined macro for compatibility reasons)
 
* [[c/language/goto|Labels]] followed by declarations and {{ttb|}<nowiki/>}}
 
* [[c/language/goto|Labels]] followed by declarations and {{ttb|}<nowiki/>}}
 +
* {{ltt|c/keyword/nullptr}} constant and the associated {{ltt|c/types/nullptr_t}} type
 +
* {{ltt|c/keyword/true}} and {{ltt|c/keyword/false}} become keywords (may be predefined macros for compatibility reasons)
 
* New preprocessor directives
 
* New preprocessor directives
 
** {{ltt|c/preprocessor/conditional|#elifdef}}
 
** {{ltt|c/preprocessor/conditional|#elifdef}}
 
** {{ltt|c/preprocessor/conditional|#elifndef}}
 
** {{ltt|c/preprocessor/conditional|#elifndef}}
 
** {{ltt|c/preprocessor/error|#warning}}
 
** {{ltt|c/preprocessor/error|#warning}}
** {{tt|#embed}}
+
** {{ltt|c/preprocessor/embed|#embed}}
 
* Pragmas for rounding direction
 
* Pragmas for rounding direction
 
** {{tt|STDC}} {{ltt|c/preprocessor/impl|FENV_ROUND}}
 
** {{tt|STDC}} {{ltt|c/preprocessor/impl|FENV_ROUND}}
Line 68: Line 81:
 
*: This macro supersedes {{ltt|c/preprocessor/replace|__STDC_IEC_559_COMPLEX__}}.
 
*: This macro supersedes {{ltt|c/preprocessor/replace|__STDC_IEC_559_COMPLEX__}}.
  
== New library features ==
+
==New library features==
 +
 
 +
===New headers===
 +
* {{header|stdbit.h}}
 +
* {{header|stdckdint.h}}
 +
 
 +
===Library features===
 
* Extended binary floating-point math functions
 
* Extended binary floating-point math functions
 
** {{todo|List TBD}}
 
** {{todo|List TBD}}
Line 88: Line 107:
 
** {{ltt|c/thread|atomic_char8_t}} type alias
 
** {{ltt|c/thread|atomic_char8_t}} type alias
 
** {{ltt|c/atomic/ATOMIC_LOCK_FREE_consts|ATOMIC_CHAR8_T_LOCK_FREE}} test macro
 
** {{ltt|c/atomic/ATOMIC_LOCK_FREE_consts|ATOMIC_CHAR8_T_LOCK_FREE}} test macro
 +
* {{ltf|c/string/byte/memset|memset_explicit}}
 
* POSIX functions
 
* POSIX functions
 
** {{ltf|c/string/byte/memccpy}}
 
** {{ltf|c/string/byte/memccpy}}
 
** {{ltf|c/string/byte/strdup}}
 
** {{ltf|c/string/byte/strdup}}
 
** {{ltf|c/string/byte/strndup}}
 
** {{ltf|c/string/byte/strndup}}
** {{ltf|c/chrono/asctime|asctime_r}}
 
** {{ltf|c/chrono/ctime|ctime_r}}
 
 
** {{ltf|c/chrono/gmtime|gmtime_r}}
 
** {{ltf|c/chrono/gmtime|gmtime_r}}
 
** {{ltf|c/chrono/localtime|localtime_r}}
 
** {{ltf|c/chrono/localtime|localtime_r}}
 
** Extensions for {{ltf|c/chrono/strftime}} and {{ltf|c/chrono/wcsftime}}
 
** Extensions for {{ltf|c/chrono/strftime}} and {{ltf|c/chrono/wcsftime}}
 
* Extensions for {{ltf|c/io/fscanf}} and {{ltf|c/io/fprintf}} function families
 
* Extensions for {{ltf|c/io/fscanf}} and {{ltf|c/io/fprintf}} function families
** {{tt|w''N''}} and {{tt|wf''N''}} length modifiers for {{ltt|c/types/integer|[u]int''N''_t}} and {{ltt|c/types/integer|[u]int_fast''N''_t}} respectively  
+
** {{tt|w''N''}} and {{tt|wf''N''}} length modifiers for {{ltt|c/types/integer|[u]int''N''_t}} and {{ltt|c/types/integer|[u]int_fast''N''_t}} respectively
 
** {{tt|H}}, {{tt|D}}, and {{tt|DD}} length modifiers for {{c|_Decimal32}}, {{c|_Decimal64}}, and {{c|_Decimal128}} respectively
 
** {{tt|H}}, {{tt|D}}, and {{tt|DD}} length modifiers for {{c|_Decimal32}}, {{c|_Decimal64}}, and {{c|_Decimal128}} respectively
 
** {{tt|b}} conversion specifier for unsigned integer types
 
** {{tt|b}} conversion specifier for unsigned integer types
Line 111: Line 129:
 
** {{ltt|c/numeric/tgmath|__STDC_VERSION_TGMATH_H__}}
 
** {{ltt|c/numeric/tgmath|__STDC_VERSION_TGMATH_H__}}
 
** {{ltt|c/chrono|__STDC_VERSION_TIME_H__}}
 
** {{ltt|c/chrono|__STDC_VERSION_TIME_H__}}
 +
** {{ltt|__STDC_VERSION_STDCKDINT_H__}}
 +
** {{ltt|__STDC_VERSION_STDBIT_H__}}
  
== Defect reports ==
+
==Defect reports==
 
{{c/language/history/DR23}}
 
{{c/language/history/DR23}}
  
== Compiler support ==
+
==Compiler support==
 
{{c/compiler support/23}}
 
{{c/compiler support/23}}
  
 
{{langlinks|ar|cs|de|es|fr|it|ja|ko|pl|pt|ru|tr|zh}}
 
{{langlinks|ar|cs|de|es|fr|it|ja|ko|pl|pt|ru|tr|zh}}

Latest revision as of 21:39, 9 February 2024

The next generation of the C standard.

Contents

[edit] Obsolete

[edit] Removed

[edit] Deprecated

[edit] New language features

[edit] Feature test macros for optional features

[edit] New library features

[edit] New headers

  • <stdbit.h>
  • <stdckdint.h>

[edit] Library features

[edit] Defect reports

Defect Reports fixed in C23 (? defects)

[edit] Compiler support

[edit] C23 core language features


C23 feature

 
Paper(s)

 
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
IBM XL C++
IBM Open XL C++ for AIX
IBM Open XL C++ for z/OS
Sun/Oracle C++
Embarcadero C++ Builder
Cray
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
_Static_assert with no message N2265 9 9 Yes Yes 6.5 2021.1.2 (clang based)
[[nodiscard]] N2267 10 9 Yes 6.4 2021.1.2 (clang based)
[[maybe_unused]] N2270 10 9 Yes 6.4 2021.1.2 (clang based)
[[deprecated]] N2334 10 9 Yes 6.4 2021.1.2 (clang based)
Attributes N2335
N2554
10 9 Yes 6.4 2021.1.2 (clang based)
IEEE 754 decimal floating-point types N2341 4.2 (partial)*
12
13.0 (partial)*
[[fallthrough]] N2408 10 9 Yes 6.4 2021.1.2 (clang based)
u8 character constants N2418 10 15 6.5 2022.2
Removal of function definitions without prototype N2432 10 15 2022.2
[[nodiscard]] with message N2448 11 10 Yes 6.4 2021.1.2 (clang based)
Unnamed parameters in function definitions N2480 11 11 Yes 6.4 2021.1.2 (clang based)
Labels before declarations and end of blocks N2508 11 16 Partial* 6.5 17.0*
Binary integer constants N2549 4.3*
11
2.9*
9
19.0 (2015)** Yes 6.5 11.0*
__has_c_attribute in preprocessor conditionals N2553 11 9 Yes 6.5 2021.1.2 (clang based)
Allow duplicate attributes N2557 11 13 Yes 6.5 2021.4 (clang-based
IEEE 754 interchange and extended types N2601 7 (partial)*
14
6 (partial)* Partial*
Digit separators N2626 12 13 19.0 (2015)** Yes 6.5 18.0*
#elifdef and #elifndef N2645 12 13 19.40*

13.1.6*

6.5 2021.4
Type change of u8 string literals N2653 13
[[maybe_unused]] for labels N2662 11 16 6.5 2022.2
#warning N2686 Yes Yes Yes 6.5 Yes
Bit-precise integer types (_BitInt) N2763 14 (partial)* 15 6.5 2022.2
[[noreturn]] N2764 13 15 6.5 2022.2
Suffixes for bit-precise integer constants N2775 14 15 2022.2
__has_include in preprocessor conditionals N2799 5 Yes 19.11* Yes 6.5 18.0
Identifier Syntax using Unicode Standard Annex 31 N2836 13 15 6.5 2022.2
Removal of function declarations without prototype N2841 13 15 2022.2


Empty initializers N2900 Partial*
13
Partial* Partial* Partial* Partial*


typeof and typeof_unqual N2927
N2930
Partial*
13
Partial*
16
19.39* Partial* Partial* Partial* Partial*
New spelling of keywords N2934 13 16 6.5
Predefined true and false N2935 13 15 2022.2
[[unsequenced]] and [[reproducible]] N2956 15
Relax requirements for variadic parameter list N2975 13 16 6.5 2023.1
Type inference in object definitions N3007 13 18
#embed N3017 15 19
constexpr objects N3018 13 19
Improved Normal Enumerations N3029 13 20*
Enumerations with fixed underlying types N3030 13 20*
__VA_OPT__ N3033 8
13
12 19.39* 6.5
Storage-class specifiers for compound literals N3038 13
nullptr N3042 13 16
 

C23 feature
 

Paper(s)
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
IBM XL C++
IBM Open XL C++ for AIX
IBM Open XL C++ for z/OS
Sun/Oracle C++
Embarcadero C++ Builder
Cray
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc

[edit] C23 library features