Get ready for a big change in the world of programming with C++23 (an update of the C++ programming language). This update comes with some powerful features that will make programming faster, easier, and more compatible across different devices. We'll look at these features, like decimal numbers and language improvements, as well as support from compilers. This article is for all C++ programmers, whether you're new or experienced, and it will give you some useful information.
What is C++23?
C++23 is an upcoming new version of C++ programming, scheduled for release on April 1, 2024. In this version of C++, there's a host of features on the horizon that will empower C++ programming across diverse domains. Let's explore some of these notable advancements:
|
C++23 an update of the C++ programming language |
Upcoming C++23 Features
Language Features
- Decimal floating-point types (_Decimal32, _Decimal64, and _Decimal128)
- Bit-precise integers (_BitInt)
- Binary integer constants
- u8 character constants
- Type change of u8 string literals
- Digit separator '
- Empty initializer ={}
- Attributes:
- [[deprecated]]
- [[fallthrough]]
- [[maybe_unused]]
- [[nodiscard]]
- [[noreturn]]
- [[reproducible]]
- [[unsequenced]]
- Unnamed parameters in function definitions
- Identical cvr-qualifications for array types and their element types
- Single-argument _Static_assert
- static_assert becomes a keyword (maybe a predefined macro for compatibility reasons)
- thread_local becomes a keyword (maybe a predefined macro for compatibility reasons)
- Labels followed by declarations and }
- nullptr constant and the associated nullptr_t type
- true and false become keywords (maybe predefined macros for compatibility reasons)
New Preprocessor Directives
- #elifdef
- #elifndef
- #warning
- #embed
Pragmas for Rounding Direction
- STDC FENV_ROUND
- STDC FENV_DEC_ROUND
Feature Test Macros for Optional Features
- __STDC_IEC_60559_BFP__
- __STDC_IEC_60559_DFP__
- __STDC_IEC_60559_COMPLEX__
Library Features
- New headers:
- Extended binary floating-point math functions
- Decimal floating-point math functions
- Floating-point formatting functions
- Library support for UTF-8
- POSIX functions:
- memccpy()
- strdup()
- strndup()
- gmtime_r()
- localtime_r()
- Extensions for strftime() and wcsftime()
- Extensions for fscanf() and fprintf() function families
- wN and wfN length modifiers for [u]intN_t and [u]int_fastN_t respectively
- H, D, and DD length modifiers for _Decimal32, _Decimal64, and _Decimal128 respectively
- b conversion specifier for unsigned integer types
- timespec_getres()
- Macro constants for width of integer types
- Additional numeric limit macros for floating-point types
- Library version-test macros
Compiler Support
C++23 compiler support is still under development, but the following compilers have already implemented some or all of the C++23 features:
- GCC 13.0 and later
- Clang 19.0 and later
- MSVC 2023
- Apple Clang 17.0 and later
Please note that this is not a complete list, and other compilers may also support C++23 features.
Conclusion:
C++23 is poised to start a new era of performance and expressiveness in C++ programming. With its new features like decimal floating-point types and bit-precise integers, developers will have powerful tools at their disposal. The updated preprocessor directives, pragmas, feature test macros, and library features further enhance C++23's capabilities. The adjusted release date to November 2023 means that C++ enthusiasts and software developers alike can anticipate the arrival of this significant update with great excitement. It's clear that C++23 is an important development that will enable developers to write more efficient, reliable, and portable C++ code, making it a compelling choice for a wide range of applications and industries.
Share Your opinions here.