frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

C++ Modules Are Here to Stay

https://faresbakhit.github.io/e/cpp-modules/
49•faresahmed•5d ago

Comments

whobre•1h ago
> auto main() -> int {

Dude…

on_the_train•1h ago
It's been the go-to syntax for 15 years now
Night_Thastus•40m ago
Go-to? I've never seen a project use it, I've only ever seen examples online.
whobre•7m ago
Same here
cpburns2009•14m ago
Now I haven't touched C++ in probably 15 years but the definition of main() looks confused:

> auto main() -> int

Isn't that declaring the return type twice, once as auto and the other as int?

yunnpp•9m ago
No. The auto there is doing some lifting so that you can declare the type afterwards. The return type is only defined once.

There is, however, a return type auto-deduction in recent standards iirc, which is especially useful for lambdas.

https://en.cppreference.com/w/cpp/language/auto.html

auto f() -> int; // OK: f returns int

auto g() { return 0.0; } // OK since C++14: g returns double

auto h(); // OK since C++14: h’s return type will be deduced when it is defined

CamperBob2•1h ago
It's like calling a Ford Mustang Mach-E the "Model T++."
few•59m ago
And their code example doesn't actually return a value!
Davidbrcz•57m ago
For main it's explicitly allowed by the standard, and no return is equal to return 0
webdevver•3m ago
i was sincerely hoping i could get

    auto main(argc, argv) -> int
         int argc;
         char **argv;
to work, but alas it seems c++ threw pre-ansi argument type declarations out.
cmovq•1h ago
Can someone using modules chime in on whether they’ve seen build times improve?
nickelpro•55m ago
import std; is an order of magnitude faster than using the STL individually, if that's evidence enough for you. It's faster than #include <iostream> alone.

Chuanqi says "The data I have obtained from practice ranges from 25% to 45%, excluding the build time of third-party libraries, including the standard library."[1]

[1]: https://chuanqixu9.github.io/c++/2025/08/14/C++20-Modules.en...

luke5441•41m ago
Yeah, but now compare this to pre-compiled headers. Maybe we should be happy with getting a standard way to have pre-compiled std headers, but now my build has a "scanning" phase which takes up some time.
feelamee•1h ago
why use modules if PCH on your diagram is not much worse in compile times?
nickelpro•53m ago
Macro hygiene, static initialization ordering, control over symbol export (no more detail namespaces), slightly higher ceiling for compile-time and optimization performance.

If these aren't compelling, there's no real reason.

bluGill•44m ago
modules are the future and the rules for are well thought out. Ever compiler has their own version of PCH and they all work different in annoying ways.
reactjs_•1h ago
Here’s the thing I don’t get about module partitions: They only seem to allow one level of encapsulation.

    Program
    - Module
      - Module Partition
whereas in module systems that support module visibility, like Rust’s, you can decompose your program at multiple abstraction levels:

    Program
    - Private Module
      - Private Module
        - Private Module
        - Public Module
      - Public Module
Maybe I am missing something. It seems like you will have to rely on discipline and documentation to enforce clean code layering in C++.
pdpi•17m ago
Rust's re-exports also allow you to design your public module structure separate from your internal structure.
groby_b•15m ago
I don't think you're missing something. The standards committee made a bad call with "no submodules", ran into insurmountable problems, and doubled down on the bad call via partitions.

"Just one more level bro, I swear. One more".

I fully expect to sooner or later see a retcon on why really, two is the right number.

Yeah, I'm salty about this. "Submodules encourage dependency messes" is just trying to fix substandard engineering across many teams via enforcement of somewhat arbitrary rules. That has never worked in the history of programming. "The determined Real Programmer can write FORTRAN programs in any language" is still true.

pjmlp•3m ago
Like most languages with modules.

Rust, Modula-2 and Ada are probably the only ones with module nesting.

w4rh4wk5•1h ago
https://arewemodulesyet.org/ gives you an overview which libraries already provide a module version.
srcreigh•45m ago
Wow, the way this data is presented is hilarious.

Log scale: Less than 3% done, but it looks like over 50%.

Estimated completion date: 10 March 2195

It would be less funny if they used an exponential model for the completion date to match the log scale.

TimorousBestie•54m ago
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.

It seems likely I’ll have to move away from C++, or perhaps more accurately it’s moving away from me.

bluGill•45m ago
If you tools are not updated that isn't the fault of C++. You will feel the same about Rust when forced to used a 15 year old version too (as I write this Rust 1.0 is only 10 years old). Don't whine to me about these problems, whine to your vendors until they give you the new stuff.
Joker_vD•28m ago
> whine to your vendors until they give you the new stuff.

How well does this usually work, by the way?

krior•28m ago
Nobody is "whining" to you. Nobody is mentioning rust. Your tone is way too sharp for this discussion.
TimorousBestie•26m ago
If C++ libraries eschew backward compatibility to chase after build time improvements, that’s their design decision. I’ll see an even greater build time improvement than they do (because I won’t be able to build their code at all).
juliangmp•23m ago
My experience with vendor toolchains is that they generally suck anyway. In a recent bare metal project I chose not to use the vendor's IDE and toolchain (which is just an old version of GCC with some questionable cmake scripts around it) and instead just cross compile with rust manually. And so far its been a really good decision.
TimorousBestie•13m ago
Yep, this aligns with my experience. I’ve yet to take the plunge into cross compiling with rust though, might have to try that.
rienbdj•34m ago
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?
Night_Thastus•34m ago
The fact that precompiled headers are nearly as good for a much smaller investment tells you most of what you need to know, imo.
fooker•14m ago
C++ templates and metaprogramming is fundamentally incompatible with the idea of your code being treated in modules.

The current solution chosen by compilers is to basically have a copy of your code for every dependency that wants to specialize something.

For template heavy code, this is a combinatorial explosion.

pjmlp•5m ago
It has worked perfectly fine while using VC++, minus the usual ICE that still come up.
yunnpp•8m ago
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't know how to compile and asked me to "change the code around this line".

So no, modules aren't even here, let alone to stay.

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.

Project Genie: Experimenting with infinite, interactive worlds

https://blog.google/innovation-and-ai/models-and-research/google-deepmind/project-genie/
222•meetpateltech•3h ago•120 comments

My Mom and Dr. DeepSeek (2025)

https://restofworld.org/2025/ai-chatbot-china-sick/
70•kieto•1h ago•25 comments

Claude Code Daily Benchmarks for Degradation Tracking

https://marginlab.ai/trackers/claude-code/
398•qwesr123•6h ago•215 comments

Drug trio found to block tumour resistance in pancreatic cancer

https://www.drugtargetreview.com/news/192714/drug-trio-found-to-block-tumour-resistance-in-pancre...
110•axiomdata316•4h ago•50 comments

Launch HN: AgentMail (YC S25) – An API that gives agents their own email inboxes

73•Haakam21•3h ago•83 comments

C++ Modules Are Here to Stay

https://faresbakhit.github.io/e/cpp-modules/
50•faresahmed•5d ago•34 comments

OTelBench: AI struggles with simple SRE tasks (Opus 4.5 scores only 29%)

https://quesma.com/blog/introducing-otel-bench/
116•stared•4h ago•64 comments

Europe’s next-generation weather satellite sends back first images

https://www.esa.int/Applications/Observing_the_Earth/Meteorological_missions/meteosat_third_gener...
602•saubeidl•13h ago•82 comments

EmulatorJS

https://github.com/EmulatorJS/EmulatorJS
60•avaer•6d ago•9 comments

US cybersecurity chief leaked sensitive government files to ChatGPT: Report

https://www.dexerto.com/entertainment/us-cybersecurity-chief-leaked-sensitive-government-files-to...
313•randycupertino•4h ago•166 comments

County pays $600k to pentesters it arrested for assessing courthouse security

https://arstechnica.com/security/2026/01/county-pays-600000-to-pentesters-it-arrested-for-assessi...
82•MBCook•1h ago•24 comments

Apple to soon take up to 30% cut from all Patreon creators in iOS app

https://www.macrumors.com/2026/01/28/patreon-apple-tax/
963•pier25•23h ago•787 comments

Reflex (YC W23) Senior Software Engineer Infra

https://www.ycombinator.com/companies/reflex/jobs/Jcwrz7A-lead-software-engineer-infra
1•apetuskey•3h ago

OpenAI's In-House Data Agent

https://openai.com/index/inside-our-in-house-data-agent
34•meetpateltech•2h ago•14 comments

Usenet personality

https://en.wikipedia.org/wiki/Usenet_personality
26•mellosouls•3d ago•10 comments

Box64 Expands into RISC-V and LoongArch territory

https://boilingsteam.com/box64-expands-into-risc-v-and-loong-arch-territory/
9•ekianjo•4d ago•1 comments

Flameshot

https://github.com/flameshot-org/flameshot
6•OsrsNeedsf2P•1h ago•1 comments

Run Clawdbot/Moltbot on Cloudflare with Moltworker

https://blog.cloudflare.com/moltworker-self-hosted-ai-agent/
84•ghostwriternr•5h ago•36 comments

Why "The AI Hallucinated" is the perfect legal defense

https://niyikiza.com/posts/hallucination-defense/
3•niyikiza•45m ago•4 comments

Making niche solutions is the point

https://ntietz.com/blog/making-niche-solutions-is-the-point/
64•evakhoury•2d ago•24 comments

How to Choose Colors for Your CLI Applications (2023)

https://blog.xoria.org/terminal-colors/
120•kruuuder•5h ago•74 comments

Heating homes with the largest particle accelerator

https://home.cern/news/news/cern/heating-homes-worlds-largest-particle-accelerator
44•elashri•4h ago•15 comments

Computing Sharding with Einsum

https://blog.ezyang.com/2026/01/computing-sharding-with-einsum/
19•matt_d•4d ago•0 comments

MakuluLinux (6.4M Downloads) Ships Persistent Backdoor from Developer's Own C2

https://werai.ca/security-disclosure.html
24•werai•2h ago•8 comments

Playing Board Games with Deep Convolutional Neural Network on 8bit Motorola 6809

https://ipsj.ixsq.nii.ac.jp/records/229345
30•mci•6h ago•8 comments

Waymo robotaxi hits a child near an elementary school in Santa Monica

https://techcrunch.com/2026/01/29/waymo-robotaxi-hits-a-child-near-an-elementary-school-in-santa-...
195•voxadam•6h ago•336 comments

The Sovereign Tech Fund Invests in Scala

https://www.scala-lang.org/blog/2026/01/27/sta-invests-in-scala.html
82•bishabosha•7h ago•58 comments

We can’t send mail farther than 500 miles (2002)

https://web.mit.edu/jemorris/humor/500-miles
616•giancarlostoro•16h ago•103 comments

Networks Hold the Key to a Decades-Old Problem About Waves

https://www.quantamagazine.org/networks-hold-the-key-to-a-decades-old-problem-about-waves-20260128/
3•makira•1h ago•0 comments

Break Me If You Can: Exploiting PKO and Relay Attacks in 3DES/AES NFC

https://www.breakmeifyoucan.com/
37•noproto•6h ago•29 comments