Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C23 standard support #84

Open
11 of 68 tasks
sheumann opened this issue Aug 2, 2023 · 0 comments
Open
11 of 68 tasks

C23 standard support #84

sheumann opened this issue Aug 2, 2023 · 0 comments

Comments

@sheumann
Copy link
Contributor

sheumann commented Aug 2, 2023

The upcoming C23 standard contains a number of new features, which we would like to add support for. This issue contains a list of significant new features in the draft C23 standard (derived from Annex M in the standard drafts). This includes features of both the language and libraries. Note that this is not a comprehensive list of all changes in the standard, and that some of these items are optional features that are not required to be implemented.

Items should be checked off in this list if they are fully implemented. If they are partially implemented, a note explaining that can be added.

  • add new keywords such as bool, static_assert, true, false, thread_local and others, and allowed implementations to provide macros for the older spelling with a leading underscore followed by a capital letter as well as defining old and new keywords as macros to enable transition of programs easily
    • alignas/alignof/bool/static_assert/thread_local are supported
  • removed integer width constraints and obsolete sign representations (so-called "1’s complement" and "sign-magnitude")
  • added a one-argument version of static_assert
  • removed support for function definitions with identifier lists
  • mandated function declarations whose parameter list is empty be treated the same as a parameter list which only contain a single void
  • harmonization with ISO/IEC 9945 (POSIX):
    • extended month name formats for strftime
      • no changes needed in the "C" locale as implemented by ORCA/C
    • integration of functions: gmtime_r, localtime_r, memccpy, strdup, strndup
  • harmonization with floating point standard IEC 60559:
    • integration of binary floating-point technical specification TS 18661-1
    • integration of decimal floating-point technical specification TS 18661-2
    • integration of floating-point types technical specification TS 18661-3
    • integration of mathematical functions technical specification TS 18661-4a
    • new maximum and minimum functions for operations recommended in ISO/IEC 60559:2020
  • made the DECIMAL_DIG macro obsolescent
    • no changes needed
  • added version test macros to library headers that contained changes to aid in upgrading and portability to be used alongside the __STDC_VERSION__ macro
  • allowed placement of labels in front of declarations and at the end of compound statement
  • added the attributes feature, which includes the attributes:
    • deprecated, for marking entities as discouraged for future use
    • fallthrough, for explicitly marking cases where falling through in switches or labels is intended rather than accidental
    • maybe_unused, for marking entities which may end up not being used
    • nodiscard, for marking entities which, when used, should have their value handled in some way by a program
    • noreturn, for indicating a function shall never return
    • reproducible, for marking function types for which inputs may always produce predictable output if given the same input (e.g., cached data) but for which the order of such calls still matter
    • unsequenced, for marking function types which always produce predictable output and have no dependencies upon other data (and other relevant caveats)
  • added the u8 character prefix to match the u8 string prefix
  • mandated all u8, u, and U strings be UTF-8, UTF-16, and UTF-32, respectively, as defined by ISO/IEC 10646
  • separated the literal, wide literal, and UTF-8 literal, UTF-16 literal, and UTF-32 literal encodings for strings and characters and now have a solely execution-based version of these, particularly execution and wide execution encodings
  • added mbrtoc8 and c8rtomb functions missing from <uchar.h>
  • compound literals may also include storage-class specifiers as part of the type to change the lifetime of the compound literal (and possibly turn it into a constant expression)
  • added the constexpr specifier for object definitions and improved what is recognized as a constant expression in conjunction with the constexpr storage-class specifier
  • added support for initialization of objects with empty braces
  • added the typeof and typeof_unqual operations for deducing the type of an expression
  • improved tag compatibility rules, enabling more types to be compatible with other types
  • added bit-precise integer types _BitInt(N) and unsigned _BitInt(N), where N can be an integer constant expression whose value is from one to BITINT_MAXWIDTH, inclusive
  • improved rules for handling enumerations without underlying types, in particular allowing for enumerations without fixed underlying type to have value representations that have a greater range than int
  • added a new colon-delimited type specifier for enumerations to specify a fixed underlying type (and which, subject to an implementation’s definitions governing such constructs, adopt the fixed underlying type’s rules for padding, alignment, and sizing within structures and unions as well as with bit-fields)
  • added a new header <stdbit.h> and a suite of bit and byte-handling utilities for portable access to many implementations’ most efficient functionality
  • modified existing functions to preserve the const-ness of the type placed into the function
  • added a feature to embed binary data as faithfully as possible with a new preprocessor directive #embed
  • added a nullptr constant and a nullptr_t type with a well-defined underlying representation identical to a pointer to void
  • added the __VA_OPT__ specifier and clarified language in the handling of macro invocation and arguments
  • mandated support for variably-modified types (but not variable-length arrays themselves)
  • parameter names may be omitted in function definitions
  • ellipses on functions may appear without a preceding parameter in the parameter list of functions and va_start no longer requires such an argument to be passed to it
    • Second argument to va_start is no longer required.
  • Unicode identifiers allowed in syntax following Unicode Standard Annex, UAX # 31
    • Mostly supported (in UCNs and for most supported characters, but not for the character ·)
  • added the memset_explicit function for making sensitive information inaccessible
  • added memalignment function to query the alignment of a pointer
  • certain type definitions (i.e., exact-width integer types such as int128_t), bit-precise integer types, and extended integer types may exceed the normal boundaries of intmax_t and uintmax_t for signed and unsigned integer types, respectively
    • no changes needed (larger types are not required)
  • names of functions, macros, and variables in the standard, where clarified, are potentially reserved rather than reserved to avoid undefined behavior for a large class of identifiers used by programs existing and to be created
  • mandated support for call_once
  • allowed ptrdiff_t to be an integer type with a width of at least 16, rather than requiring an integer type with a width of at least 17
    • no changes needed
  • added the __has_include feature for conditional inclusion expression preprocessor directives to check if a header is available for inclusion
  • changed the type qualifiers of the _Imaginary_I and _Complex_I macros
  • added qualifier preserving macros for bsearch, memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wmemchr, and wcsstr
  • added @ (U+0040 Commercial At), $ (U+0024 Dollar Sign), and ` (U+0060 Grave Accent, "Backtick") into the source and execution character set
  • enhanced the auto type specifier for single object definitions using type inference
  • added the #elifdef and #elifndef conditional inclusion preprocessor directives
  • added the #warning preprocessing directive
  • binary integer literals and appropriate formatting for input/output of binary integer numbers
    • binary integer literals are supported
  • digit separators with ' (single quotation mark)
  • removed conditional support for mixed wide and narrow string literal concatenation
  • added support for additional time bases, as well as timespec_getres, in <time.h>
  • added support for new interface timegm to retrieve the broken-down time, in <time.h>
  • zero-sized reallocations with realloc are undefined behavior
    • no changes needed
  • added free_sized and free_aligned_sized functions
  • added an unreachable feature which has undefined behavior if reached during program execution
  • added printf and scanf length modifiers for intN_t, int_fastN_t, uintN_t, and uint_fastN_t
@sheumann sheumann mentioned this issue Aug 2, 2023
77 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant