C++23, the upcoming version of the C++ programming language set to be finalized in 2023, is poised to introduce several important changes aimed at improving the language’s performance and usability. One of the most anticipated features is the addition of module support, which will significantly enhance compilation speed and code organization. For years, C++ developers have struggled with the inefficiencies of header files and the preprocessor. By introducing modules, C++23 eliminates the need for the traditional .h/.cpp
file distinction, simplifying the source code and allowing for faster, more efficient builds. The inclusion of modules is expected to be one of the most significant advancements in the language’s history, fundamentally changing how developers structure and compile their code.
A key part of this change is the introduction of a standard library module, called std
, which will allow developers to access standard library features through a more efficient mechanism. For example, the classic “Hello World” program will look different in C++23, reflecting the new modular approach. The elimination of header files and the reduction in pre-compilation time means faster development cycles, and the modular approach also promises better code hygiene. By clearly separating interface from implementation, modules make it easier to manage large codebases, reduce errors, and maintain a clean separation of concerns.
In addition to modules, C++23 will also bring improvements to the language’s support for coroutines, which enable asynchronous programming. Coroutines allow functions to be suspended and resumed, making them ideal for tasks like I/O operations and event-driven programming. Although coroutines have been available in C++20, C++23 will provide enhanced support for them, making asynchronous programming in C++ more intuitive and efficient. These improvements are part of the language’s ongoing evolution to address modern programming needs, such as better concurrency and more readable asynchronous code.
Despite the ambitious goals for C++23, the pandemic has slowed down progress in some areas. Language designer Bjarne Stroustrup acknowledged that many features planned for the release, such as pattern matching, contracts, and a comprehensive model for concurrency (executors), have been postponed to C++26. The virtual nature of the development process during the pandemic made it difficult for the community to engage in meaningful design discussions, which led to a more cautious approach for this release. Nevertheless, C++23 is set to finalize many crucial enhancements and pave the way for the next major iteration of the language in C++26.