6 ms·
There's also the opposite problem: older devs will use outdated features and have best practices in place that are now considered antipatterns. This exacerbates
by jupp0r 4y ago
There's also the opposite problem: older devs will use outdated features and have best practices in place that are now considered antipatterns. This exacerbates the existing difficulties to modernize legacy code bases and creates incentives to not do so. New devs are forced to learn C++ from 20 years ago which is much worse than modern C++.
- deviantbit 4y agoThe difference between C++ today, and what we had 20 years ago is not much. C++ has functionality built in today, we didn't have, but the OS provided, and now the language has many features we wished we had years ago. Example: Variadic templates. When that happened, the problems we would bang our head against the wall with magically vanished. Twenty years ago, every implementation of the std library had serious bugs in it. It was avoided. Not the case today. I remember a std::map iterators not working. Watcom's C++ had serious flaws with it, but many exciting products were still created with it. We didn't complain. We were happy, and worked around our problems. I think the root of peoples issue with C++ is with template meta programming portions of it, which you can completely ignore, and grow into.
- pencilguin 4y agoTemplate metaprogramming is hardly ever needed anymore. C++20 has better built-in features that for most of what was done with it, that compile much faster. Almost all C++ programmers completely ignore it. You can too.
- deviantbit 4y agoNew way? You mean, expanded.
- pencilguin 4y ago??
- shaklee3 4y agotemplate metaprogramming is used extensively in libraries. c++20 didn't really change that; it makes metaprogramming nicer to read, but it does not obviate the need for it.
- astrange 4y agoMy experience with C++ is that every five years I come in and see people claiming that not only should I never do whatever I was told five years ago, but actually it was never popular and nobody ever did it. Mostly about ways to allocate objects or use smart pointers. I'm still wondering why `(int)` is spelled `reinterpret_cast<int>` in C++. Do they just like hitting keys on the keyboard?
- germandiago 4y ago> I'm still wondering why `(int)` is spelled `reinterpret_cast<int>` in C++ 1. because it is greppable and unsafe 2. because there is also static_cast and dynamic_cast 3. Because in C (int) is all three at once and not greppable -> C will let you do whatever, C++ will not let you do with a static_cast everything you can do with a (T) cast. All in all, it is nice to ask, but if you do not know what you are talking about except for the surface, then, you should not say: > Do they just like hitting keys on the keyboard? No, we do not, but we hate even more to get an ungreppable, undecipherable (semantically) casting lost somewhere in several tens of thousands of lines of code :) This eases finding the suspicious code more easily.
- wewtyflakes 4y agoIt doesn't matter since (int) is in the C++ language regardless of how we feel about it, so it seems their point still stands.
- robotresearcher 4y agoSeems to be found by grep fine: % echo 'int x = (int)1.2f;' > foo % grep '(int)' foo int x = (int)1.2f; Does greppable mean something else in this context?
- ghghgfdfgh 4y agoI'm assuming they didn't mean "grep" in a literal sense, rather that it is easier to find keywords like "reinterpret_cast" when scanning your eyes through code, whereas with C-style casts you'd have a much harder time.
- commandlinefan 4y ago> have best practices in place that are now considered antipatterns Like using C++ you mean?
- jupp0r 4y agoC++ is a tool and it still has its use. If you have ever tried to slowly sprinkle Rust into a large C++ code base you will know that it's hard, laborious and error-prone. For completely new projects that don't need existing C++ libraries: sure, I wouldn't use C++ nowadays. There's tons of good reasons that lots of actively developed code is still C++ though.