Differences between revisions 1 and 2
Revision 1 as of 2017-01-24 12:52:59
Size: 1225
Revision 2 as of 2017-01-24 13:11:02
Size: 1290
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:
* http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4047.pdf

C++ Modules

A module system is coming to C++, this page describes the GCC implementation state.

The goal of the module system is to avoid huge header files, thus speeding up compilation. What distinguishes it from things like precompiled headers are:

  • Not solving the 'preprocessor problem'
  • Composabililty of multiple modules
  • Explicit code annotations to define visible interfaces

Implementation State

Development branch: 'c++-modules' (svn://gcc.gnu.org/svn/gcc/branches/c++-modules).

The branch was created Jan 2017, so it is very early days, and I expect it to be several months before there's something of interest.


I aim to reuse (with suitable abstraction) as much LTO machinery as possible. LTO currently writes out both type trees and gimple instructions, encapsulating the information into additional sections of the output files. Modules needs to write out both type trees and FE AST, but not gimple. It also needs to read that information back into the FE. The data will probably be emitted into not-the-object-file, which will be similar to PCH behaviour.


* http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4047.pdf * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4610.pdf

None: cxx-modules (last edited 2018-08-31 20:09:50 by NathanSidwell)