Logo
Articles Compilers Libraries Books MiniBooklets Assembly C++ Linux Others Videos
Advertisement

Article by Ayman Alheraki on January 11 2026 10:35 AM

The Adoption of Modules in C++20 Challenges, Delays, and Progress

The Adoption of Modules in C++20: Challenges, Delays, and Progress

When Will the C++20 Module Feature Be Fully Supported by All Compilers?

The Modules feature in C++20 aims to improve performance, reduce compilation times, and simplify dependency management between files. However, this feature is still in the process of being implemented and developed across various compilers. As of December 2024, major compilers such as GCC, Clang, and MSVC support the feature in an experimental or partial manner.

  • GCC: Experimental support for Modules was introduced in version 10, and the feature is still being improved. Developers need to enable specific experimental flags to activate support.

  • Clang: Modules support began in later versions (more stable in version 12), but there are still limitations and compatibility issues.

  • MSVC (Microsoft Visual C++): MSVC has relatively advanced support, offering experimental Modules support since version 16.9. Microsoft continues to refine compatibility and stability.

It is clear that full adoption of Modules by compilers will be a gradual process, as development teams must overcome several technical challenges before providing stable and reliable support.

Have Any Software Companies Converted Their Libraries or Created Libraries Using Modules Instead of #include?

Some companies and projects have started experimenting with Modules and transitioning towards them, but adoption is still limited due to various factors, including compatibility issues across compilers and the time and resources required to rewrite code to comply with Modules. However, some major projects in the industry have begun using Modules in specific parts of their source code.

For instance:

  • Google: Some development teams at Google have explored using Modules within certain projects, particularly to reduce compilation time and improve performance.

  • Microsoft: The C++ development team at Microsoft is working on improving Modules support in libraries such as the C++ Standard Library and STL, with a gradual transition expected in the future.

Despite this, the use of Modules in public libraries and open-source software remains less common compared to traditional #include usage.

My Opinion on the Delay in Adopting Modules

The delay in adopting Modules can be attributed to several factors:

  1. Compatibility: Since C++ uses the #include system, which is central to all compilers and libraries, transitioning to a new structure requires considerable time to ensure compatibility across different compilers.

  2. Perceived Benefits: Initially, the potential benefits of Modules (such as reducing compilation time and simplifying complexity) were not as clear to some developers and compilers, which led to hesitation in adoption.

  3. Technical Challenges: Modules require handling complex issues related to code organization, compatibility with existing libraries, and structuring files within different packages.

  4. Reliance on Legacy Tools: Many projects heavily depend on legacy tools (such as Makefiles and libraries reliant on #include), making it difficult to adopt Modules.

Are There Issues with Using It?

Yes, developers face several challenges when using Modules:

  1. Lack of Compiler Compatibility: As mentioned earlier, compiler support for Modules is not yet unified, leading to compatibility problems across different environments.

  2. Code Restructuring Complexity: Transitioning to Modules requires developers to restructure large portions of their source code, which can be difficult and time-consuming, especially in large projects.

  3. Open Source Library Compatibility: Many open-source libraries do not support Modules, complicating the process for developers looking to adopt this feature.

  4. Lack of Supporting Tools: There is a shortage of tools that fully support Modules, making its adoption more complex.

Differences Between Compilers in Terms of Using Modules

  1. GCC: GCC supports Modules experimentally, and developers need to enable it through specific command-line options such as -fmodules or -fmodules-ts. However, there are still some compatibility issues with full C++20 standards.

  2. Clang: Clang offers more stable Modules support in later versions, but it also requires activation via -fmodules and -std=c++20. There are still challenges related to performance and compatibility with other compilers.

  3. MSVC: MSVC provides better support for Modules, with the -experimental-modules flag used to enable the feature. However, there are still some limitations that affect cross-compiler compatibility.

Conclusion

While the Modules feature in C++20 holds great potential for improving performance and reducing compilation time, its full implementation in compilers requires more time and effort. As of now, #include remains the dominant choice in most software projects. However, with the continued development of compiler support and increased interest in the feature, a gradual shift toward wider adoption of Modules is expected in the future.

Advertisements

Responsive Counter
General Counter
1003488
Daily Counter
2688