3 ms·
Sure, but why the trivial prefix? Doesn't sound too ensuring then.
by rurban 8y ago
Sure, but why the trivial prefix? Doesn't sound too ensuring then.
- saagarjha 8y agoI'm assuming the "trivial" refers to "trivial" types.
- loeg 8y agoSure, but it's unclear what the benefit of leaving auto C++ objects uninitialized is.
- eridius 8y agoIIRC, auto C++ objects aren't uninitialized, they're default-initialized, but said default-initialization may leave them with uninitialized fields. I would hope that this new automatic variable initialization would also apply to those fields of default-initialized auto C++ objects.
- kazinator 8y agoBuilt-in types like int are also "object"; only C++ class objects can have constructors that initialize them.
- olliej 8y agoAuto declarations don’t mean uninitialised, they get default initialisation, which for many types means “undefined”.
- loeg 8y agoI should have been more clear. What's the benefit of leaving automatic storage C++ object memory uninitialized?
- saagarjha 8y agoIt's fast?
- loeg 8y agoThe proposal would already accepti a performance tradeoff to initialize memory of uninitialized "trivial" variables. I'm not sure why you would want to draw a line in the sand at trivial variables only. What makes non-trivial uninitialized object memory higher penalty or lower risk?