News for hackers. Stuff that matters.
Re:Initialization in C++ is bonkers (2017) by loeg on Friday May 16, 2025 @03:56PM (#44009234)
> -ftrivial-auto-var-init=pattern

I believe this only helps for trivial automatic variables; not non-trivial automatic variables (structs/classes) that contain uninitialized trivial members.

Re:Initialization in C++ is bonkers (2017) by TuxSH on Sunday May 18, 2025 @09:27AM (#44021278)
Ah, you're right, thanks for correcting me! This also doesn't apply to heap-allocated variables, though I think p2795r2 should cover all these cases.

I wonder if (for stack variables) this is due to an implementation detail in the compiler. After all, non-trivial classes have 'actual' constructors that run and that is supposed to initialize their respective class instances...