HN
Today

C++26 is done ISO C++ standards meeting, Trip Report

C++26 has been finalized, ushering in significant features like Reflection, enhanced memory safety, and language-level contracts, hailed as the most impactful release since C++11. Hacker News users are excited about the safety improvements and Reflection, but a fervent debate rages over the complexity introduced by contracts and the persistent woes of C++'s build system and module adoption. This update highlights C++'s ongoing evolution, balancing new capabilities with traditional concerns about complexity and tooling.

165
Score
132
Comments
#2
Highest Rank
25h
on Front Page
First Seen
Mar 29, 6:00 PM
Last Seen
Mar 30, 6:00 PM
Rank Over Time
2225791214131410121891010111113151920242929

The Lowdown

The ISO C++ committee has completed the technical work for C++26, marking it as the most compelling release since C++11. This standard introduces several highly anticipated and significant features aimed at modernizing the language and improving developer experience, particularly in safety and abstraction.

  • Reflection: Described as the "biggest upgrade" since templates, enabling C++ to introspect and generate code at compile-time, opening new avenues for efficient abstractions.
  • Memory Safety Enhancements: Eliminates undefined behavior for reading uninitialized local variables and hardens the standard library with bounds-safe operations for common types. This has been proven at scale by Apple and Google to prevent thousands of bugs with minimal performance overhead.
  • Contracts: Adds language-level preconditions, postconditions, and contract_assert for functional safety, despite facing sustained opposition within the committee due to concerns about complexity and design.
  • std::execution (Sender/Receiver): A unified asynchronous model for concurrency and parallelism, designed to foster structured, data-race-free programming, though the report cautions about an initial learning curve and the need for supplementary libraries.
  • Rapid Adoption Predicted: The report anticipates swift industry adoption of C++26 due to high demand for its features and strong, early compiler support from GCC and Clang, contrasting with slower adoption of recent prior standards.
  • C++29 Future Focus: Plans for the next standard emphasize further advancements in memory safety and profiles, building on the foundation laid by C++26 to make C++ "safer-by-default."

In essence, C++26 propels the language into a new era, emphasizing safety, powerful abstractions, and efficient concurrency, while striving to retain the zero-overhead principle that defines C++.

The Gossip

Contractual Concerns and Complexity Budgets

The inclusion of contracts in C++26 proved highly divisive, echoing Bjarne Stroustrup's public reservations. Critics argue that contracts add unnecessary complexity and are an "incomplete" design, potentially introducing "footguns" into an already intricate language. They question if C++ has exceeded its "complexity budget." Proponents counter that contracts standardize existing practices (assertions, pre/postconditions) and are vital for static analysis and formal verification, making them a necessary, albeit complex, evolution.

Build System Battles and Module Maladies

A significant portion of the discussion revolved around C++'s perennial build system issues and the perceived failure of C++ Modules. Many users express deep frustration with the complexity of existing tools like CMake and the lack of a standardized package manager comparable to Rust's Cargo. Critics argue that C++ Modules are a "failed idea" with poor adoption, lacking compiler uniformity and creating more tooling complexity than they solve. The sentiment is that modern C++ needs a robust, standard build and package management solution more than new language features.

Reflecting on Reflection and Future Safety

The introduction of Reflection was widely welcomed, seen as a long-awaited and transformative feature for C++, with some humorously noting its arrival years after they might have found it most useful. The memory safety improvements in C++26, particularly the elimination of UB for uninitialized variables and the hardened standard library, were also positively noted. However, skepticism persists about how much safer C++ can truly become, especially when compared to Rust, leading to debates about whether C++'s "new era" of safety is genuinely transformative or merely an incremental improvement.

Compiler Catch-Up and Adoption Rates

While the article highlights rapid compiler implementation, comments reveal lingering concerns about the actual adoption speed of new C++ features in the real world. Users discuss the discrepancy in C++26 feature support between GCC (more advanced) and Clang, particularly for Reflection and Contracts. Many experienced developers note that while new features are exciting, their practical use in large-scale production environments is often delayed by tooling, ecosystem, and corporate policy, leading to a significant lag between standardization and widespread real-world application.