▲ | gollum999 7 months ago | ||||||||||||||||||||||||||||||||||||||||
Which features in particular? One of C++'s core tenants is (and has been since the 90's) zero-cost abstractions. Or really, "zero-runtime-cost abstractions"; compile times tend to increase. Obviously some abstractions necessarily require more computation (e.g. raw pointers vs reference-counted smart pointers). But in many cases new features (if implemented correctly!) give better semantics and additional compile-time safety while still compiling down to equivalent binary. | |||||||||||||||||||||||||||||||||||||||||
▲ | einpoklum 7 months ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||
So, here's the thing: Officially, C++ is committed to "What you don’t use, you don’t pay for (zero-overhead rule)”. This is item 2.4 in the reaffirmed design goals: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p34... but the current ABI _forces_ some abstractions to have unnecessary cost. For example: "Why can a T* be passed in register, but a unique_ptr<T> cannot?" https://stackoverflow.com/q/58339165/1593077 another example is improvements in the implementation of parts of the standard library. And that is not the only thing that prevents zero-cost abstraction. C++ does not support pointer restrction, see: https://stackoverflow.com/tags/restrict-qualifier/info in practice, compilers support it for some contexts. (Anoter, minor issue is the discrepancy of "No viral annotation" and "no heavy annotation" with the need to mark things noexcept to avoid exceptio handling overhead.) | |||||||||||||||||||||||||||||||||||||||||
|