Yes, actually. Mainly library members, though, it's rare that a language feature will be deprecated because they don't want to risk breaking very important 20-year-old unmaintained libraries that the entirety of modern infrastructure depends on. (It's a meme, but we meme about it because it's true.)
The most notable one is dynamic exception lists (throw(whatever) in the function signature), which got deprecated and mostly removed because nobody ever cared enough to actually support it. It was on life support for a while, where the "throws nothing" version (the only one that ended up being not worthless) is a synonym for noexcept, and every other throw-list is dead, before it got the boot too in C++20 or so. And similarly, the most notable library feature is probably "good" old std::auto_ptr, which got deprecated in C++11 because it was kinda really bad and unique_ptr was better, and finally got the boot in C++17.
Apart from that... it's hard to find a good list online, really. There's a partial list here, but you'd probably have to scour the various standards to find something more complete.
Now, that said, being deprecated (or even removed) doesn't mean that compiler vendors actually listen, because they're the ones that have to actually support all those ancient legacy codebases. Especially if the compiler includes version switches. If a compiler includes, e.g., both -std=c++11 and -std=c++17, then it will never remove features that were removed in C++17; it can disable them for -std=c++17 mode, but it still needs to be able to provide them for -std=c++11 mode.
So what it ultimately boils down to is that the language tries to deprecate & remove things, but legacy code is holding the compilers hostage.
Eh... not really, weirdly enough. Some of them are just the same thing in different places and/or contexts (e.g., "copy initialisation", "constant initialisation", "initialisation with auto", "in-class member initialisers" & "constructor member initialiser list", and "if/switch init-statements" are all the same feature in different contexts), and most of the others do different things under the hood (e.g., constructor delegation allows you to chain constructors, default initialisation lets you use the type's base rules, copy initialisation duplicates another object (or is optimised into direct optimisation if possible), direct initialisation hard-codes into the executable, zero initialisation sanitises memory, reference initialisation is singled out because it either registers a second name or creates a pointer, etc..).
It's a case where the language makes it look more complex than it actually is... which, admittedly, happens a lot in C++. Most of these really just boil down to "how Type t = val; works depends on what Type is", more than anything else.
View all comments
Show parent comment
64
u/Blue_Moon_Lake 19d ago
I'm pretty sure some of these are useless and should be deprecated.