C2Y (C standard revision)
| C language revisions |
|---|
C2Y is an informal name for the next revision of the C programming language after C23 that is hoped to be released in the 2020s, hence the '2' in "C2Y". Early working drafts of C2Y were released after the January 2024 WG14 meeting. The current working draft N3685 was released in September 2025.[1] Changes have already started to be integrated in popular C/C++ compilers: GCC 15 and Clang 19.[2] [3] [4]
Features
[edit ]The following are changes integrated into the latest working draft of C2Y.[5] [1] Keep in mind that the following changes are still is the draft stage, thus anything may change before the final ratification.
Note: This section is not complete. Changes listed in the History section will be incrementally migrated into this section over time.
Constants
[edit ]- Add
0oand0Ooctal literal constant prefixes; such as0o137and0O247.[6] This change is similar to the0band0Bbinary prefixes that were previously added in the C23 & C++14 standards,[7] and earlier established0xand0Xhexadecimal prefixes. - Add
{}delimited escape sequences for C strings:\o{}for octal (arbitrary number of octal digits),\x{}for hexadecimal (arbitrary number of hex digits),\u{}for universal character name (sequence of hex digits that represents a valid Unicode character); such as"\o{110}\x{65}llo"which creates a string identical to "Hello" (in ASCII), and"\u{2021}"which is the Unicode value of a double dagger "‡" character.[6] This change was previously added in the C++23 standard.[8] The\u{}format is an established syntax in Rust and JavaScript computer languages too.
Operators
[edit ]- Add
_Countofkeyword & operator, andcountof()macro in the new<stdcountof.h>header of the C standard library to determine the number of elements of an array, such aslong baudrate[22]; size_t n = countof(baudrate);meansnis 22.[9] [10] [11]
Statements
[edit ]- For the
ifstatement, add support for variable declaration, such asif (int err = xmit_ch('X')) log_err(err);, similar to how theforchange was added in the C99 standard. The new variable can be used inside the scope of all branches ofif,else,else iftoo. In C++, variable declaration has been allowed since the C++98 standard, further enhanced in the C++17 standard to allow for a second clause so the variable could be used within the condition itself, and C will use the later for C++ compatibility.[12] - For the
switchstatement, add support forcaseranges by placing...(ellipsis) between two integer constants, such ascase 1 ... 3:which would be equivalent tocase 1: case 2: case 3:.[13] - For the
forstatement, add named/labelled loops and transferring control through namedbreakandcontinue(multi-level breaks). The syntax is the same as in Java.[14]
Preprocessor
[edit ]- Add
__COUNTER__macro. Each time used, the preprocessor expands it into a unique sequential integer literal, starting from 0 and increments by 1 every time it is expanded. Though already in use by many compilers, this change makes it an official standarized macro for C.[15]
Standard Library
[edit ]Existing functions
[edit ]- For functions
strtol(),strtoll(),strtoul(),strtoull(), and their wide counterpartswcstol(),wcstoll(),wcstoul(),wcstoull(), if the value of base is 8 (octal), the characters0oor0Omay optionally precede the sequence of digits. If a sign is present, the0oor0Ofollows the sign.[6] - For functions
strnlen_s()andwcsnlen_s(), their description was updated to be worded similar to the newstrnlen()andwcsnlen()functions (below).[16]
New functions
[edit ]- Add
strnlen()andwcsnlen()functions, similar tostrlen()but instead a specified maximum number of characters will be searched for the end of string character. Both functions have been part of the GNU C library since at least 2001 and later became part of the POSIX.1-2008 standard.[16] - Add bit utility functions / macros / types in header
<stdbit.h>to examine many integer types. All start withstdc_to minimize conflict with legacy code and 3rd party libraries.[17] More bit utility functions were previously added in the C23 standard.[18]- Add
stdc_memreverse8()(8-bit) andstdc_memreverse8uN()(exact-width 8-bit) to reverse memory, such as0xAABBCCDDureversed into0xDDCCBBAAu. For function name suffix: "u" means unsigned, "N" means a multiple of 8, such as 8, 16, 32, ...[17] - Add
stdc_rotate_left_uc(),stdc_rotate_left_us(),stdc_rotate_left_ui(),stdc_rotate_left_ul(),stdc_rotate_left_ull(), and genericstdc_rotate_left()to rotate bits left.[17] - Add
stdc_rotate_right_uc(),stdc_rotate_right_us(),stdc_rotate_right_ui(),stdc_rotate_right_ul(),stdc_rotate_right_ull(), and genericstdc_rotate_right()to rotate bits right.[17] - Add
stdc_load8_leuN(),stdc_load8_beuN(),stdc_load8_aligned_leuN(),stdc_load8_aligned_beuN(), andstdc_load8_lesN(),stdc_load8_besN(),stdc_load8_aligned_lesN(),stdc_load8_aligned_besN()to perform endian-aware 8-bit loads. For function name suffix: "b" means big endian, "l" means little endian, "u" means unsigned, "s" means signed, "N" means a multiple of 8 such as 8, 16, 32, ...[17] - Add
stdc_store8_leuN(),stdc_store8_beuN(),stdc_store8_aligned_leuN(),stdc_store8_aligned_beuN(), andstdc_store8_lesN(),stdc_store8_besN(),stdc_store8_aligned_lesN(),stdc_store8_aligned_besN()to perform endian-aware 8-bit stores. For function name suffix: "b" means big endian, "l" means little endian, "u" means unsigned, "s" means signed, "N" means a multiple of 8 such as 8, 16, 32, ...[17]
- Add
Obsolete features
[edit ]Obsolete C programming language features removed or deprecated in the working draft of C2Y:[5] [1]
Constants
[edit ]- For octal literals, such as
057, the leading zero will be retained but marked as obsolescent to avoid breaking existing code. Compilers should output a warning that will hopefully encourage rewrites. As of N3353, there will be no changes toprintf(), but WG14 would like to see a future paper that propose changes.[6]
Keywords
[edit ]- Remove
_Imaginaryfrom the list of keywords.[19]
Compiler support
[edit ]The following compilers implement an experimental compiler flag to support C2Y:
History
[edit ]The highlighted changes in this section have been summarized in the feature sections above.
January 2024
[edit ]The following changes were made after the January 2024 WG14 meeting:[5] [1]
- N3192 - "Sequential hexdigits".
- Editorial - Adjusted a footnote in Annex K from "reserved" to "potentially reserved".
June 2024
[edit ]The following changes were made after the June 2024 WG14 meeting:[5] [1]
- N3064 - "Writing to multibyte character files".
- N3232 - "Round-trip rounding".
- N3233 - "Recommendation for printf rounding".
- N3239 - "Some constants are literally literals, v2".
- N3242 - "Problematic use of "correctly rounded".
- N3244 - "Slay Some Earthly Demons I".
- N3247 - "fopen "p" and bring fopen’s mode closer to POSIX 202x".
- N3254 - "Accessing byte arrays, v4".
- N3259 - "Support ++ and -- on complex values".
- N3260 - "_Generic selection expression with a type operand".
- N3273 - "alignof of an incomplete array type".
- N3274 - "Remove imaginary types, v3".
- Editorial - "may" -> "can" for alignment with ISO/IEC directives.
- Editorial - Table headings changed to match ISO/IEC directives.
September 2024
[edit ]The following changes were made after the September/October 2024 WG14 meeting:[5] [1]
- N3272 - "strftime broken-down structure usage (Option 1 - "Undefined Behavior)".
- N3286 - "Floating-point exception for Macro Replacements".
- N3287 - "Nonsensical Parenthetical in Mathematics Specification".
- N3291 - "Decimal Floating-Point Number Term Misuse".
- N3298 - "Introduce Complex Literals".
- N3303 - "HUGE_VAL Corrections".
- N3305 - "Leftover WANT_... Macros for <math.h> and Decimal Floating-Point".
- N3312 - "Relax Atomic Alignment Requirements".
- N3322 - "Allow Zero Length operations on Null Pointers (Including in the Library)".
- N3323 - "How Do You Add One To Something? (By Using The Proper Type)".
- N3324 - "'pole-error' Wording Fix".
- N3326 - "Standardize strnlen and wcsnlen".
- N3340 - "Slay Some Earthly Demons II".
- N3341 - "Slay Some Earthly Demons III".
- N3342 - "Slay Some Earthly Demons IV".
- N3344 - "Slay Some Earthly Demons VI".
- N3345 - "Slay Some Earthly Demons VII".
- N3346 - "Slay Some Earthly Demons VIII".
- N3349 - "abs Without Undefined Behavior".
- N3353 - "Obsolete Octal and Provide New, Proper Escape Sequences".
- N3355 - "Named/Labeled Loops".
- N3356 - "if Declarations".
- N3364 - "SNAN Initialization".
- N3366 - "Restartable Functions for Efficient Character Conversions".
- N3367 - "More Modern Bit Utilities".
- N3369 - "The _Lengthof Operator".
- N3370 - "Case Ranges in switch Statements".
- N3461 - "range error definition followup".
February 2025
[edit ]The following changes were made after the February 2025 WG14 meeting:[5] [1]
- N3363 - "<stdarg.h> Wording".
- N3401 - "SIGFPE and I/O (v2)".
- N3405 - "Improved Wording for Treatment of Error Conditions in <math.h>".
- N3409 - "Slay Some Earthly Demons X".
- N3410 - "Slay Some Earthly Demons XI".
- N3411 - "Slay Some Earthly Demons XII".
- N3418 - "Slay Some Earthly Demons XIV".
- N3447 - "Chasing Ghost I - "Constant Expressions".
- N3448 - "Chasing Ghosts II - "Accessing Allocated Storage".
- N3451 - "Initialization of Anonymous Structures and Unions (v2)".
- N3452 - "Complex Literals Warning".
- N3459 - "Integer and Arithmetic Constant Expressions".
- N3460 - "Complex Operators".
- N3466 - "Clarifications on Null Pointers in the Library".
- N3469 - "Big Array Size Survey (_Lengthof -> _Countof, and <stdcountof.h> header)".
- N3478 - "Slay Some Earthly Demons XIII".
- N3481 - "Slay Some Earthly Demons XVI".
- N3482 - "Slay Some Earthly Demons XVII".
- N3492 - "Improved treatment of error conditions for functions that round result".
- N3496 - "Clarify the Specification of the Width Macros".
- N3505 - "Preprocessor integer expressions, II".
August 2025
[edit ]The following changes were made after the August 2025 WG14 meeting:[5] [1]
- N3348 - "Matching of Multi-Dimensional Arrays in Generic Selection Expressions".
- N3457 - "The __COUNTER__ predefined macro".
- N3484 - "Slay Some Earthly Demons V".
- N3500 - "Clarification for Complex Suffix Specification".
- N3511 - "Remove "category" from "type category" in footnote".
- N3517 - "Array subscripting without decay".
- N3525 - "static_assert without UB".
- N3532 - "Member Access of an Incomplete struct Should Not Be Allowed".
- N3535 - "frexp and double-double".
- N3536 - "Clarify wording of cproj".
- N3537 - "Correct and clarify 7.3.1 Introduction of Complex Arithmetic <complex.h>".
- N3544 - "Classification of the register Storage-class Specifier".
- N3558 - "Chasing Ghosts I - "Constant Expressions and Objects of Known Constant Size".
- N3563 - "Representation of Pointers and nullptr_t".
- N3577 - "Rename uimaxabs to umaxabs".
- N3598 - "Make text consistent between creal and cimag".
- N3623 - "Slay Some Earthly Demons XIV - "Definition of Main".
- N3652 - "Composite types v1.3".
See also
[edit ]References
[edit ]- ^ a b c d e f g h "WG14 Document Repository". open-std.org. Archived from the original on September 30, 2025.
- ^ a b "GCC 15 Release Series". GNU.org. Archived from the original on October 27, 2025.
- ^ a b "LLVM Clang 19 Adds Initial "-std=c2y" Support For The Next C Standard". Phoronix.com. July 2, 2024. Archived from the original on October 27, 2025.
- ^ a b "C Support in Clang - C2Y implementation status". LLVM.org. Archived from the original on October 27, 2025.
- ^ a b c d e f g "WG14-N3685: Working Draft for ISO/IEC 9899:202Y" (PDF). open-std.org. September 28, 2025. Archived (PDF) from the original on October 31, 2025.
- ^ a b c d "WG14-N3353: Obsolete implicitly octal literals and add delimited escape sequences". open-std.org. October 18, 2024. Archived from the original on October 3, 2025.
- ^ "WG14-N2630: Formatted input/output of binary integer numbers (rev3) (for C23)" (PDF). open-std.org. January 1, 2021. Archived (PDF) from the original on December 14, 2022.
- ^ "WG21-p2290r3: Delimited escape sequences (for C++23)" (PDF). open-std.org. February 25, 2022. Archived (PDF) from the original on October 11, 2025.
- ^ "WG14-N3369: New _Lengthof() operator (v4)" (PDF). open-std.org. October 1, 2021. Archived (PDF) from the original on August 31, 2025.
- ^ "WG14-N3469: The Big Array Size Survey". open-std.org. February 3, 2025. Archived from the original on October 7, 2025.
- ^ "The Big Array Size Survey for C". thephd.dev. November 6, 2024. Archived from the original on April 4, 2025.
- ^ "WG14-N3356: 'if' declarations, v3". open-std.org. September 18, 2024. Archived from the original on August 4, 2025.
- ^ "WG14-N3370: Case range expressions, v3.1". open-std.org. October 1, 2024. Archived from the original on August 4, 2025.
- ^ "WG14-N3355: Named loops, v3". open-std.org. September 18, 2024. Archived from the original on October 9, 2025.
- ^ "WG14-N3457: The __COUNTER__ predefined macro". open-std.org. January 25, 2025. Archived from the original on September 19, 2025.
- ^ a b "WG14-N3326: Standardize strnlen and wcsnlen (v3)" (PDF). open-std.org. September 1, 2024. Archived (PDF) from the original on April 21, 2025.
- ^ a b c d e f "WG14-N3367: More Modern Bit Utilities". open-std.org. September 4, 2024. Archived from the original on October 3, 2025.
- ^ "WG14-N3022: Modern Bit Utilities (for C23)". open-std.org. July 6, 2022. Archived from the original on December 24, 2022.
- ^ "WG14-N3274: Remove imaginary types" (PDF). open-std.org. June 14, 2024. Archived (PDF) from the original on August 24, 2025.
Further reading
[edit ]- N3685 (latest working draft with C2Y changes); WG14; September 2025. (free download)
- N3220 (first working draft after C23; differs from final C23 draft N3219 only in one footnote); WG14; February 2024. (free download)
External links
[edit ]- WG14 Document Repository
- WG14 Meetings - agenda and minutes