• Sources: primary, discussion
  • Summary: Daniel Lemire shows that span() = default keeps a struct trivial, so value-initialization zeroes it, while span() {} is user-provided and does not. In his loop GCC 15.2 and 16.2 route fields through a temporary and copy them, taking 7.75 and 8.04 ns per span against 1.73 ns with {}, while GCC 14.3 and Clang 21 run both at about 1.74 ns. The post drew 116 points and 176 comments on Hacker News.
  • Why it matters: Hot C++ value types built with GCC 15 or later may need their codegen checked when constructors are defaulted.
  • Comments: Most of the thread compares C++ constructors with the static factory functions of Rust, Go and Zig. Commenters note that C++ constructors allow in-place construction, while Rust has no guaranteed copy elision yet and has an open issue to add in-place initialization.