Visibility, Reachability, Linkage – The Three Secret Spices of C++ Modules

with Daniela Engert

Check out free documentation and modules on Microsoft Learn

Modules are probably the most impactful and most transformative major recent addition to the C++ language. From a user perspective, Modules are conceptually simple and the idea is easy to grasp. And with the C++20 ecosystem maturing, using Modules and adopting them into every-day programming is both feasible and advantageous. But what is the secret sauce of Modules, that makes them so tasty? There are three pieces in the C++ language puzzle that exist since the inception of the language but are mostly irrelevant in typical usage of 'classical' C++ and hardly any programmer needs to know much about them. No fear – this hasn't changed, no old horse is required to learn new tricks to take advantage of the power of Modules. But if you are interested in how three little (key-)words are able to unleash this power, you might feel the urge to understand what visibility of names, reachability of declarations and their semantic properties, and (language) linkage actually mean in the world of Modules.

  • give a short recap of what Modules are
  • explore the concept of visibility
  • dive into declarations, semantic properties, and the difference between visibility and reachability
  • look at the so-called language linkage and linker symbols