(no title)
koyote | 2 months ago
I have production code where we specifically do not initialise some data in order to be more performant (it gets set before it is read, but not at declaration as we do not have the values at that point).
I do agree that this (and numerous other footguns) make C++ a pain to work with. I also think it's too late to fix.
Ideally, all values would be initialised by default and instead you could forcefully construct something that is not initialised (e.g. something like `no_init double x[100];`). Instead, we have the bug-prone default and twenty different ways to initialise something, each with their own caveats.
C++ would be a much better language if most if not all defaults were reversed.
simonask|2 months ago