C++26 is done ISO C++ standards meeting, Trip Report
86 points by pjmlp 3 hours ago | 43 comments

suby 2 hours ago
I am somewhat dismayed that contracts were accepted. It feels like piling on ever more complexity to a language which has already surpassed its complexity budget, and given that the feature comes with its own set of footguns I'm not sure that it is justified.

Here's a quote from Bjarne,

> So go back about one year, and we could vote about it before it got into the standard, and some of us voted no. Now we have a much harder problem. This is part of the standard proposal. Do we vote against the standard because there is a feature we think is bad? Because I think this one is bad. And that is a much harder problem. People vote yes because they think: "Oh we are getting a lot of good things out of this.", and they are right. We are also getting a lot of complexity and a lot of bad things. And this proposal, in my opinion is bloated committee design and also incomplete.

reply
addaon 2 hours ago
I can’t speak to the C++ contract design — it’s possible bad choices were made. But contracts in general are absolutely exactly what C++ needs for the next step of its evolution. Programming languages used for correct-by-design software (Ada, C++, Rust) need to enable deep integration with proof assistants to allow showing arbitrary properties statically instead of via testing, and contracts are /the/ key part of that — see e.g. Ada Spark.
reply
derriz 40 minutes ago
C++ is the last language I'd add to any list of languages used for correct-by-design - it's underspecified in terms of semantics with huge areas of UB and IB. Given its vast complexity - at every level from the pre-processor to template meta-programming and concepts, I simply can't imagine any formal denotational definition of the language ever being developed. And without a formal semantics for the language, you cannot even start to think about proof of correctness.
reply
steveklabnik 13 minutes ago
The devil is in the details, because standardization work is all about details.

From my outside vantage point, there seems to be a few different camps about what is desired for contracts to even be. The conflict between those groups is why this feature has been contentious for... a decade now?

Some of the pushback against this form of contracts is from people who desire contracts, but don't think that this design is the one that they want.

reply
StilesCrisis 2 hours ago
Right, I think the tension here is that we would like contracts to exist in the language, but the current design isn't what it needs to be, and once it's standardized, it's extremely hard to fix.
reply
bluGill 60 minutes ago
The people who did contracts are aware of ada/spark and some have experience using it. Only time will tell if it works in c++ but they at least did all they could to give it a chance.

Note that this is not the end of contrats. This is a minimun viable start that they intend to add to but the missing parts are more complex.

reply
dislikedopinion 53 minutes ago
Might be the case that Ada folks successfully got a bad version of contracts not amenable for compile-time checking into C++, to undermine the competition. Time might tell.
reply
raincole 58 minutes ago
I mean... it's C++. The complexity budget is like the US government's debt ceiling.
reply
Maxatar 16 minutes ago
Without a significant amount of needed context that quote just sounds like some awkward rambling.

Also almost every feature added to C++ adds a great deal of complexity, everything from modules, concepts, ranges, coroutines... I mean it's been 6 years since these have been standardized and all the main compilers still have major issues in terms of bugs and quality of implementation issues.

I can hardly think of any major feature added to the language that didn't introduce a great deal of footguns, unintended consequences, significant compilation performance issues... to single out contracts is unusual to say the least.

reply
dataflow 22 minutes ago
> Second, conforming compiler and standard library implementations are coming quickly. Throughout the development of C++26, at any given point both GCC and Clang had already implemented two-thirds of C++26 features. Today, GCC already has reflection and contracts merged in trunk, awaiting release.

How far is Clang on reflection and contracts?

reply
LatencyKills 2 hours ago
This is awesome. I've was a dev on the C++ team at MS in the 90s and was sure that RTTI was the closest the language would ever get to having a true reflection system.
reply
AyanamiKaine 16 minutes ago
I am actually excited for post and pre conditions. I think they are an underused feature in most languages.
reply
mohamedkoubaa 2 hours ago
Biggest open question is whether the small changes to the module system in this standard will actually lead to more widespread adoption
reply
zarzavat 2 hours ago
The best thing the C++ WG could do is to spend an entire release cycle working on modules and packaging.

It's nice to have new features, but what is really killing C++ is Cargo. I don't think a new generation of developers are going to be inspired to learn a language where you can't simply `cargo add` whatever you need and instead have to go through hell to use a dependency.

reply
mgaunard 2 hours ago
In my experience, no one does build systems right; Cargo included.

The standard was initially meant to standardize existing practice. There is no good existing practice. Very large institutions depending heavily on C++ systematically fail to manage the build properly despite large amounts of third party licenses and dedicated build teams.

With AI, how you build and integrate together fragmented code bases is even more important, but someone has yet to design a real industry-wide solution.

reply
lenkite 18 minutes ago
Speedy convenience beats absolute correctness anyday. Humans are not immortal and have finite amount of time for life and work. If convenience didn't matter, we would all still be coding in assembly or toggling hardware switches.
reply
ho_schi 34 minutes ago
I’m still surprised how people ignore Meson. Please test it :)

https://mesonbuild.com/

And Mesons awesome dependency handling:

https://mesonbuild.com/Dependencies.html

https://mesonbuild.com/Using-the-WrapDB.html#using-the-wrapd...

https://nibblestew.blogspot.com/2026/02/c-and-c-dependencies...

I suffered with Java from Any, Maven and Gradle (the oldest is the the best). After reading about GNU Autotools I was wondering why the C/C++ folks still suffer? Right at that time Meson appeared and I skipped the suffering.

    * No XML
    * Simple to read and understand
    * Simple to manage dependencies
    * Simple to use options

Feel free to extend WrapDB.
reply
luka598 2 hours ago
Agreed, arcane cmake configs and or bash build scripts are genuinely off-putting. Also cpp "equivalents" of cargo which afaik are conan and vcpkg are not default and required much more configuring in comparison with cargo. Atleast this was my experience few years ago.
reply
mgaunard 49 minutes ago
It's fundamentally different; Rust entirely rejects the notion of a stable ABI, and simply builds everything from source.

C and C++ are usually stuck in that antiquated thinking that you should build a module, package it into some libraries, install/export the library binaries and associated assets, then import those in other projects. That makes everything slow, inefficient, and widely dangerous.

There are of course good ways of building C++, but those are the exception rather than the standard.

reply
NetMageSCW 29 minutes ago
I would suggest importing binaries and metadata is going to be faster than compiling all the source for that.
reply
stackghost 32 minutes ago
>There are of course good ways of building C++, but those are the exception rather than the standard.

What are the good ways?

reply
groundzeros2015 2 hours ago
I didn’t think header only was that bad - now we have a nightmare of incompatible standards and compilers.
reply
jjmarr 2 hours ago
No, because most major compilers don't support header units, much less standard library header units from C++26.

What'll spur adoption is cmake adopting Clang's two-step compilation model that increases performance.

At that point every project will migrate overnight for the huge build time impact since it'll avoid redundant preprocessing. Right now, the loss of parallelism ruins adoption too much.

reply
forrestthewoods 2 hours ago
No. Modules are a failed idea. Really really hard for me to see them becoming mainstream at this point.
reply
AyanamiKaine 18 minutes ago
Can you explain why you think modules are a failed idea? Because not that many use them right now?

Personally I use them in new projects using XMake and it just works.

reply
m-schuetz 2 hours ago
The idea is great, the execution is terrible. In JS, modules were instantly popular because they were easy to use, added a lot of benefit, and support in browsers and the ecoysystem was fairly good after a couple of years. In C++, support is still bad, 6 years after they were introduced.
reply
evanmoran 57 seconds ago
Exactly. C++ is still waiting for its "uv" moment, so until then modules aren't even close to solved.
reply
Xraider72 2 hours ago
No idea if modules themselves are failed or no, but if c++ wants to keep fighting for developer mindshare, it must make something resembling modules work and figure out package management.

yes you have CPM, vcpkg and conan, but those are not really standard and there is friction involved in getting it work.

reply
StilesCrisis 57 minutes ago
Much like contracts--yes, C++ needs something modules-like, but the actual design as standardized is not usable.

Once big companies like Google started pulling out of the committee, they lost their connection to reality and now they're standardizing things that either can't be implemented or no one wants as specced.

reply
hrmtst93837 27 minutes ago
"Failed idea" gives modules too much credit. Outside old codebases, almost no one outside C++ diehards have the patience for the build and tooling circuss they create, and if you need fast iteration plus sane integration with existing deps, modules are like trading your shoes for roller skates in a gravel lot. Adopting them now feels like volunteering to do tax forms in assembbly.
reply
levodelellis 2 hours ago
Great. C++20 has been my favorite and I was wasn't sure what the standards says since it's been a while. I'll be reading the C++26 standard soon
reply
VerifiedReports 18 minutes ago
As long as programmers still have to deal with header files, all of this is lipstick on a pig.
reply
jjmarr 7 minutes ago
You don't on new projects. CMake + ninja has support for modules on gcc, clang, and MSVC.

This should be your default stack on any small-to-medium sized C++ project.

Bazel, the default pick for very large codebases, also has support for C++20 modules.

reply
affenape 2 hours ago
Finally, reflection has arrived, five years after I last touched a line in c++. I wonder how long would it take the committee, if ever, to introduce destructing move.
reply
porise 55 minutes ago
I don't care until they stop pretending Unicode doesn't exist.
reply
delduca 2 hours ago
Sadly, transparent hash strings for unordered_map are out.
reply
secondcoming 3 minutes ago
It is annoying that they didn't just apply this to all containers
reply
rustyhancock 2 hours ago
I look forwards to getting to make use of this in 2040!

Proper reflection is exciting.

reply
bigbuppo 2 hours ago
GCC has it marked as 'RESOLVED FIXED' as of about a week and a half ago. So, it's coming.

Also, useful: https://gcc.gnu.org/projects/cxx-status.html

reply
rustyhancock 16 minutes ago
Support in GCC isn't what limits my usage of latest C++ at work.
reply
the__alchemist 22 minutes ago
Seeing that pic at the top of the article, and reflecting on my own experiences with rust: It is wild just how male-centric systems programming languages are. I'm from a career backround that's traditionally male-dominated (military aviation), but the balance is far more skewed among C, C++ and Rust developers.
reply
throwawaypath 3 minutes ago
Please don't use Hacker News as a religious or ideological battleground. It tramples curiosity. Please don't pick the most religiously provocative thing in an article or post to complain about in the thread. Find something interesting to respond to instead.
reply
the__alchemist 2 minutes ago
This is interesting!
reply