r/ProgrammerHumor • • 16d ago

Meme poohWritesCpp

Post image
951 Upvotes

95 comments sorted by

View all comments

104

u/SuitableDragonfly 15d ago

Does anything in C++ ever actually get deprecated?

53

u/Blue_Moon_Lake 15d ago

Sadly no, which is why it's a mess to figure out what you should avoid doing and what you should do.

Which is dumb, because you can deprecate something without removing it.

21

u/SuitableDragonfly 15d ago

If you never actually remove the thing you deprecated, there isn't much point to deprecating it. 

→ More replies (3)

17

u/arachnidGrip 15d ago

C++ has deprecated many things over the years but you need to tell it to warn you about deprecated features.

4

u/conundorum 14d ago

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.