4 ms·
Yeah, that's the biggest question that came to my mind too. Why can't you deprecate something that needs fixing up manually?
by Karellen 9y ago
Yeah, that's the biggest question that came to my mind too. Why can't you deprecate something that needs fixing up manually?
- sillysaurus3 9y agoC++ code bases are massive. It would be a nice rule to stick to, honestiy.
- CJefferson 9y agoThe idea is that if you want to deprecate something, you should tell people how to fix their code, so they can get working again with minimal work. However, even if it could be fixed up, I don't think it will get deprecated. C++ is (rightly in my mind) extremely cautious about removing things -- it's easy to ignore std::bind, it's just a library function. On the other hand, I'd be annoyed if my perfectly working C++ code base I've been building over 10 years just broke one day. One thing I love about C++ and C is that I can leave my code for 5 or even 10 years, come back, and expect it to still work just fine.
- lklklkj2342487 9y agoIsn't it what the standard compiler switch is for? For instance if your codebase builds fine with -std=c++17 and std::bind would have been removed in C++20, your code base would still compile fine because the compiler would figure it out.
- CJefferson 9y agoUnfortunately, that's hard in C++ because lots of code often ends up in headers because templated code must be in headers, and so then you can't link a C++17 and a C++20 library together (for example). Also, it's nice to be able to use new features without having to go and re-write lots of existing code. It does however fix the basic problem of a complete program. Hopefully, one day modules will fix this and we'll be able to link modules from different versions of C++ together, but I'm not holding my breath.
- Karellen 9y agoHang on, deprecated != removed. Deprecated just means "do not use in new code", and you'll probably get a diagnostic by default for existing uses, which you might even be able to turn off with a compiler switch. Also, not being able to create an automated tool to rewrite someone's code is not the same as not being able to tell them how to fix the code themselves.
- gknoy 9y ago> Deprecated just means "do not use in new code" I originally learned that "deprecated" was meant to indicate that the language no longer promised to include that feature in a future version. So, it still works now, but this is your warning that you should be moving away from it.
- kazinator 9y agoMerriam-Webster gives these meanings for "deprecate": "to pray against something, such as an evil (archaic)", "to avert", "to play down" (e.g. one's talent), "to express disapproval of, to disparage".
- kazinator 9y agoHow this definition is relevant is that the word is used specifically for features that are looked down upon as being harmful in some way, and so using them in programs is creates some kind of risk in addition to "this won't build when it goes away". The dictionary meaning which comes into play in the software maintenance use of "deprecated" is that "disapprove/disparage" one. Something that will be removed because it is unfashionable, and being replaced by shiny new idioms, is "obsolescent". Rather than abruptly removing such features, we phase them through an obsolescence period. Deprecated example: the C gets function (almost impossible to use without creating a security hole, now removed from ISO C). Obsolescent example: bzero function. (Appears in tradtional BSD sockets networking code, superseded by memset).
- djur 9y agoThe C++ standard defines it like that: "Normative for the current edition of the Standard, but having been identified as a candidate for removal from future revisions. An implementation may declare library names and entities described in this section with the `deprecated` attribute."