C++ module

C++20 Modules

In C++, the embodiment of a source unit is the translation unit. In simple words, we can call it the C++ source file.

Now, with the introduction of modules, we have a new type of translation unit called the module unit.

The impact is immediate !

When we write legacy-free modern C++20 code, we can now choose to write a module instead of a header file. We can now create a type-safe binary artifact instead of relying on macro hackery, C pre-processor and header file.

import strikr.json;

instead of

#include "strikr/json.h"

There is much more to modules and a lot of innovation is possible. As we evolve this article, stay tuned for the details.

C++20 Modules presentation

Florian et' al presentation on C++20 Modules at GNU Tools Track (day 2), Linux Plumbers Conference 2020.

Reference

image credit: FSF, GNU, GCC project.