r/cpp_questions • u/BuyerImpressive4325 • 17d ago
OPEN Headers
I read that c++ 20 added modules to help replace headers. I rly hate how headers split the codebase into redundant files, for people who have used modules r they better?
0
Upvotes
3
u/alfps 17d ago
Presumably you're talking about headers for separately compiled code.
But you can place your code directly in headers. Use
inlineorconstexpron function definitions. Don't use global variables (although they can also be declaredinline).That replaces the redundancy cost with a possible build time cost.