Hacker News Viewer

C++ Modules Are Here to Stay

by faresahmed on 1/24/2026, 6:49:05 AM

https://faresbakhit.github.io/e/cpp-modules/

Comments

by: yunnpp

I recently started a pet project using modules in MSVC, the compiler that at present has best support for modules, and ran into a compiler bug where it didn&#x27;t know how to compile and asked me to &quot;change the code around this line&quot;.<p>So no, modules aren&#x27;t even here, let alone to stay.<p>Never mind using modules in an actual project when I could repro a bug so easily. The people preaching modules must not be using them seriously, or otherwise I simply do not understand what weed they are smoking. I would very much appreciate to stand corrected, however.

1/29/2026, 8:21:57 PM


by: reactjs_

Here’s the thing I don’t get about module partitions: They only seem to allow one level of encapsulation.<p><pre><code> Program - Module - Module Partition </code></pre> whereas in module systems that support module visibility, like Rust’s, you can decompose your program at multiple abstraction levels:<p><pre><code> Program - Private Module - Private Module - Private Module - Public Module - Public Module </code></pre> Maybe I am missing something. It seems like you will have to rely on discipline and documentation to enforce clean code layering in C++.

1/29/2026, 7:24:46 PM


by: rienbdj

From the outside looking in, this all feels like too little too late. Big tech has decided on Rust for future infrastructure projects. C++ will get QoL improvements… one day and the committees seem unable to keep everyone happy or disappoint one stake holder. C++ will be around forever, but will it be primarily legacy?

1/29/2026, 7:56:21 PM


by: w4rh4wk5

<a href="https:&#x2F;&#x2F;arewemodulesyet.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;arewemodulesyet.org&#x2F;</a> gives you an overview which libraries already provide a module version.

1/29/2026, 7:26:47 PM


by: fooker

C++ templates and metaprogramming is fundamentally incompatible with the idea of your code being treated in modules.<p>The current solution chosen by compilers is to basically have a copy of your code for every dependency that wants to specialize something.<p>For template heavy code, this is a combinatorial explosion.

1/29/2026, 8:15:55 PM


by: Night_Thastus

The fact that precompiled headers are nearly as good for a much smaller investment tells you most of what you need to know, imo.

1/29/2026, 7:56:30 PM


by: cmovq

Can someone using modules chime in on whether they’ve seen build times improve?

1/29/2026, 7:05:11 PM


by: feelamee

why use modules if PCH on your diagram is not much worse in compile times?

1/29/2026, 7:09:11 PM


by: TimorousBestie

I can’t deploy C++ modules to any of the hardware I use in the shop. Probably won’t change in the near-to-mid future.<p>It seems likely I’ll have to move away from C++, or perhaps more accurately it’s moving away from me.

1/29/2026, 7:35:54 PM


by: whobre

&gt; auto main() -&gt; int {<p>Dude…

1/29/2026, 6:52:02 PM


by: up2isomorphism

“C includes show it age.” But C++ is stating not because of there is a “++” there but because of there is a “C”.

1/29/2026, 8:36:03 PM


by: GrowingSideways

[dead]

1/29/2026, 7:57:48 PM