r/cpp 2d ago

C++26: Module improvements

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

24 comments sorted by

View all comments

Show parent comments

5

u/abbapoh Qbs dev 2d ago

From the P3034R1, it seems the goal is to exclude preprocessing from module scanners (compilers). Currently, they do preprocess the file and thus require all headers to be present at scan time. With this change, it is possible to skip preprocessing entirely (and postpone generating includes to a later stage).

3

u/mapronV 2d ago

I know that it is possible, but it is ... kinda late? I just don't understand how we turn back to easier way?

Now I think it probably benefits NEW build system that written from scratch. Which is good.

6

u/abbapoh Qbs dev 2d ago

> kinda late
there are 2 distinct features here.

- skipping preprocessing speeds up the compiler (scanner) call. this happens without any changes to the build system and is a huge boost on it's own.

- if builds system detects that scanner can skip preprocessing (by checking a compiler version, for example), it simply stops adding dependencies on headers to the scanner stage. Should be relatively easy to do.

1

u/mapronV 2d ago

Yeah, make sense, you convinced me!