GCC 16 has been released

· ai · Source ↗

TLDR

  • GCC 16 ships C++20 as the new default standard, major vectorizer improvements, C++26 reflection, and numerous libstdc++ ABI changes.

Key Takeaways

  • Default C++ standard moves from -std=gnu++17 to -std=gnu++20; existing builds may break without explicit -std= flags.
  • C++26 reflection (P2996R13) lands behind -std=c++26 -freflection; contracts, expansion statements, and constexpr exceptions also included.
  • Vectorizer gains support for uncounted loops, alignment peeling for vector-length-agnostic loops, and better early-break code generation.
  • libstdc++ has ABI breaks in <atomic>, <semaphore>, <syncstream>, std::format, std::partial_ordering, std::variant, and range adaptors; C++20 code should not assume binary compatibility with older GCC.
  • std::regex rewritten to use a heap-based stack, eliminating stack overflows on large inputs.

Hacker News Comment Review

  • Early adopters on Debian sid are already using C++26 reflection for serialization/deserialization, noting practical gains but lamenting lack of an LSP server in the GCC ecosystem.
  • std::start_lifetime_as<T> (P2590R2) highlighted as an under-discussed but important addition for safe zero-copy I/O buffer type-punning without UB.

Notable Comments

  • @gavinray: argues std::start_lifetime_as<T> is the correct non-UB replacement for pointer type-punning in zero-copy I/O code and will likely be overlooked.

Original | Discuss on HN