3 ms·
C++ has a bazillion different ways of initializing a value, most of which contain syntactic footguns of some kind that don't do what you probably intended. That
by UncleMeat 3y ago
C++ has a bazillion different ways of initializing a value, most of which contain syntactic footguns of some kind that don't do what you probably intended. That's not fundamental complexity of reality, that's messy evolution over decades coupled with the inability to break backwards compatibility.
C++ also does "lie" about reality in a lot of ways, in the sense that the actual compiled program behaves quite a bit differently than a plain reading of the code implies to a nonexpert. The most obvious form of this is the rules for effect ordering. Even the recurring complaints about the compiler doing unexpected things based on the as-if rule and undefined behavior seem to count here.
- pjmlp 3y agoActually, it has enough for having a 200+ pages book full of them. "C++ Initialization Story: A Guide Through All Initialization Options and Related C++ Areas" https://www.amazon.com/Initialization-Story-Through-Options-Related/dp/B0BW38DDBK https://www.amazon.com/Initialization-Story-Through-Options-...
- ModernMech 3y agoC++ is the poster child for incidental complexity.
- bluGill 3y agoThe reality is people have 30 year old code bases, and so a messy evolution without breaking backward compatibility is and important part of reality. C++ could have been a much better language without backwards compatibility - but nobody would used it and so what is the point.
- UncleMeat 3y agoI don't think that C++'s rigorous adherence to backwards compatibility (include binary compatibility) is a bad choice. It has served the language well. It just has consequences.