Modules are one of the four big features of C++20: concepts, modules, ranges, and coroutines. Modules promise a lot: shorter compile times, macro isolation, abolishing header files, and avoiding ugly workarounds. Before I present the advantages of modules, I want to step back and explain their benefits.

Why do we need modules?

Let me start with a simple executable. For obvious reasons, I create a “Hello World” program.

Making an executable main out of the program main.cpp with GCC increases its size by factor 226226.

Get hands-on with 1400+ tech skills courses.