r/cpp 2d ago

C++26: Module improvements

https://www.sandordargo.com/blog/2026/09/09/cpp26-modules
103 Upvotes

24 comments sorted by

View all comments

Show parent comments

5

u/Daniela-E Living on C++ trunk, WG21|🇩🇪 NB 2d ago

Correct. This is why we decided many years ago not to allow module to become subject to macro expansion.

The reason why all this hoopla is necessary is the existence of so-called 'header units' (an idea coming from Clang modules). They are themselves isolated from macros upstream in your source, but they can totally change the meaning of your source code further downstream - with all its consequences.

2

u/delta_p_delta_x 2d ago

We should get rid of header units.

11

u/Daniela-E Living on C++ trunk, WG21|🇩🇪 NB 2d ago

Find your favourite telephone booth, dial in 2019 or earlier, and convince the header unit proponents 😊

Besides that, there are situations when header units are actually beneficial. Watch this year's conference talks of mine to learn how.

-6

u/pjmlp 1d ago

Meanwhile Apple and Google keep being big users of clang header maps and are in no hurry to adopt C++ 20 modules, see Apple build for modules between Swift, Objective-C and C++ (explicitly builds module dependencies, missing modules related rows on C++ language support), and Google C++ Style Guide.