News for hackers. Stuff that matters.
Re:C++ Modules Are Here to Stay by fasterik on Thursday January 29, 2026 @05:51PM (#46817983)
I get by without modules or header files in my C++ projects by using the following guidelines:

- Single translation unit (main.cpp)

- Include all other cpp files in main

- Include files in dependency order (no forward declarations)

- No circular dependencies between files

- Each file has its own namespace (e.g. namespace draw in draw.cpp)

This works well for small to medium sized projects (on the order of 10k lines). I suspect it will scale to 100k-1M line projects as long as there is minimal use of features that kill compile times (e.g. templates).

Re:C++ Modules Are Here to Stay by zabzonk on Thursday January 29, 2026 @06:19PM (#46818306)
This might be OK for someone using your files (a bit like a header-only library) but not so great for team development.
Re:C++ Modules Are Here to Stay by w4rh4wk5 on Thursday January 29, 2026 @06:32PM (#46818419)
You still organize the big file into sections to keep things together that are semantically related. For Git it mostly doesn't matter whether it's 100 small files or a single big one.
Re:C++ Modules Are Here to Stay by indil on Thursday January 29, 2026 @06:10PM (#46818189)
I believe that's called a unity build. Really nice speedup.
Re:C++ Modules Are Here to Stay by zabzonk on Thursday January 29, 2026 @06:18PM (#46818281)
SQLite calls this an "amalgamation". It is easy and convenient for users (not developers) of SQLite code.

https://sqlite.org/amalgamation.html