7 ms·
It's no wonder. C++ is deeply and irreparably broken, yet instead of fixing anything they just pile up more features in an effort to compete with Rust and Go. M
by LessDmesg 7y ago
It's no wonder. C++ is deeply and irreparably broken, yet instead of fixing anything they just pile up more features in an effort to compete with Rust and Go. Modern C++ is like a 19th century horse carriage with a big subwoofer (but you have to bring a bunch of 9V batteries), huge hot-rod wheels (but no amortization so don't even think about going above 20 kmh) and an airplane engine from Rolls-Royce (which is there for the sake of heating only).
- imron 7y ago> yet instead of fixing anything they just pile up more features in an effort to compete with Rust and Go I used to be a C++ diehard, but modern C++ is why I started learning Rust. If I'm going to have to learn a whole bunch of new idioms and rules, I might as well do it with a language that has the new features and safety built-in, rather than bolted on.
- rumanator 7y ago> I used to be a C++ diehard, but modern C++ is why I started learning Rust. If I'm going to have to learn a whole bunch of new idioms and rules You don't. Just because you bump a version number it doesn't mean you are forced to use all the bells and whistles.
- Rizz 7y agoThat stops working once you're no longer a solo developer, but part of a team, then you need to learn everything any of your fellow developers might use. You might as well focus on learning a new language and having access to new jobs where you don't have to deal with legacy languages.
- rumanator 7y ago> That stops working once you're no longer a solo developer It doesn't. If you have any experience working on C++ projects you will be very aware that deciding which feature is and is not used is the kind of stuff which is defined in the project's coding guidelines docs, along with naming conventions and choice of build system. With C++ you only have to use a feature introduced after C++11 if you decide you really want to use it. Some projects even in this very day still don't use smart pointers or exceptionsor std::array. Some people still do the old C with classes thing. Moreover, the world does not come to an end if you arrive at a project and need to learn a feature provided by a programming language.
- cowsandmilk 7y ago> If you have any experience working on C++ projects you will be very aware that deciding which feature is and is not used is the kind of stuff which is defined in the project's coding guidelines And you will find that you have to learn these features once they are allowed in the guidelines. Some workplaces stick to the old features. Some regularly update with pushes toward use of modern features. When your coding guidelines prefer modern C++, you have to learn it.
- tcbawo 7y agoThe sentiment of dreading having to learn new language features (as in being forced to) does not compute to me. Being a software developer, you should always be learning new things.
- armitron 7y agoThe complexity that emerges out of C++ with most/all of its features is immense to the point where it's clearly not worth the investment when there are so many alternatives out there. Nobody should be expected to deal with a language so complex that it takes a decade or more of effort before one can say with confidence he truly understands it. Which is why C++ is dying and those other alternatives are finding so much appeal with new generations of programmers.
- simias 7y agoThat's a very optimistic way of looking at things. More than a decade ago (pre-C++11) I used to be a pretty proficient C++ developer. I had a bunch of books about C++ designs, I would use Boost left and right, I knew my design patters, I knew advanced templating tricks etc... Then I kind of grew frustrated by the complexity and super long build times and for a few years I left C++ on the side, going back to C and other languages. Now I'm a big fan of Rust. These days when I see a modern C++ codebase using "auto" all over the place, lambdas, the new constructor/initializer syntax, std::move and more, it can be very tricky for me to understand what some code is doing. I feel like I'm reading a new C-based language where I can understand most of it but I feel like some key components are eluding me. Generally I end up figuring it out but I really don't feel comfortable modifying the code because I don't understand all the implications. Very few languages, especially as old and huge as C++, change so drastically and so fast. And again, I considered myself an advanced C++ user not so long ago. >With C++ you only have to use a feature introduced after C++11 if you decide you really want to use it. If you're the original developer who makes the decisions. If you end up working on a project using a different subset than the one you're used to then you're screwed. That's what the parent is talking about.
- 72deluxe 7y agoTrue to some extent but education is good and knowing the language you are using can only be a good thing. The same could be said of English. Would you switch to another language because someone uses a word you have never used before?
- vips7L 7y agoLet's not pretend there are jobs in Rust or whatever you think replaces C++.
- nmca 7y agoOn the flip side, I learned low-level programming in rust, and am thankful that $bigcorp uses modern c++ so the initial gap was smaller. Rust is still better though.
- gumby 7y agoThink about it the opposite way: the modern language gives you a much safer and more expressive way to express your algorithms and still gives you access to the large library of existing code.
- imron 7y ago> Just because you bump a version number it doesn't mean you are forced to use all the bells and whistles. But I want to use those features. I want memory safety and a way to say this variable owns the memory, vs that variable which is only borrowing it. I want move semantics in some cases and copy semantics in others. I want lambdas so I don't need to define new functions (or classes) to handle simple visitor patterns (or other cases where passing a 'function' makes sense). These are good, useful features that I'd like to use to make my code more safe, more performant and more readable, and while C++ can do these things to some degree, there's boiler plate and new rules (rule of 5 vs rule of 3) and gotchas, compared to a language like Rust that has these things built in, with more safety and without compromising performance, and for me it made sense to start using it instead. I still have projects in C++ that I'll maintain with modernish C++ rather than re-writing them, but for new things where I have a say in the matter, I'll choose Rust.
- ncmncm 7y agoI see that you have not kept up. Since C++17 it's "rule of zero": you don't need to write any of them, because the compiler does it. As the language gets more capable, the code you write gets simpler. I don't think that is happening in Rust.
- imron 7y ago> I see that you have not kept up. I have not (C++14 onwards was roughly where I started paying less attention), and that was partly my point. C++ has gone through dramatic change, and if I'm going to go through that dramatic change, I might as well do it with a language that has modern features and safety built in, and doesn't require extra boilerplate to do it. Looking up the rule of zero, it seems there's still some debate about whether it's a good thing or not [0] (don't know if it's been resolved yet), and it still doesn't preclude you from knowing about the rule of 5 and the side-effects of declaring or not declaring certain operators/constructors/destructors. > As the language gets more capable, the code you write gets simpler. > I don't think that is happening in Rust. This happens quite often in Rust, see for example error handling and the evolution of the ? operator, and the recent addition of async/await, and unlike c++, as the language gets more capable the changes required in terms of coding style and updating your mental model of how things work is usually not so dramatic. 0: http://scottmeyers.blogspot.com/2014/03/a-concern-about-rule-of-zero.html http://scottmeyers.blogspot.com/2014/03/a-concern-about-rule...
- ncmncm 7y agoDo not feed the trolls. The net number of people adopting C++ in any unit time dwarfs by orders of magnitude the number adopting Rust; and the number already using C++ exceeds that of Rust by many more. That will remain true for a long time. As a consequence, any improvement to C++, either core language or library, has overwhelmingly larger lasting real-world benefit than any corresponding feature in Rust. Rust pursues benefits by making a class of low-level errors hard to express, at some cost to expressiveness, and at quite substantial cost to adopters who must learn to work around the limitation (which they do). Against such cost it provides some convenient new control flow features, and leaves behind many C and C++ misfeatures that C++ cannot. C++, instead, pursues benefits by making the language increasingly able to capture semantics in libraries, and thereby deliver thoroughly optimized and tested semantics to users without compromise. The result is that C++ users, by using such libraries, are able to code at a level high above that where the bugs prevented by Rust would manifest, and write less code that could harbor bugs of any kind, overall. It is not clear whether adoption of high-level coding practices by coders using or switching to C++ will produce more benefit than those adopting Rust, and coding without access to such libraries. I have placed my own bet, and we will see. But we can say with certainty that every coder who switches to modern, safe C++ from C or C-like C++, or to Rust, is a net win for humanity. And, if Rust in the end fails to grow out of its boutique niche (which is still absolutely possible), everyone later leaving Rust for C++ will bring to it high expectations that will incrementally raise the quality level of new C++ code. Bad-mouthing of C++ by Rust fans may feel good, but it causes a net harm to humanity by the degree to which it reduces the number of coders who switch to modern C++ from C. The number of C coders who switch to Rust, instead, is far, far too small to compensate for such harm. So the only defensible, responsible behavior is for C++ and Rust users to promote C++ and Rust (not necessarily in that order) and concentrate on getting coders off C.
- LessDmesg 7y agoYou have some strange ideas about why people use C instead of C++ these days. People continue using C not because C++ lacks coroutines or something else (a strange argument for C which has almost no features to speak of), and not because they hate safety. No, people use C dor the sake of portability, for the sake of embedded systems, and for the sake of utter simplicity where that is required. Weaning them off C to C++ is impossible because C++ already doesn't fit their requirements. In fact, Rust is better suited to embedded devices than C++, so there's no real need to proselytize C++ to C programmers. Or to anyone, I would argue, because C++ is a terrible language nearly impossible to write safe software in, as well as an ergonomical, developmental and compilational pain in the ass. In fact, I believe that in terms of developer time wasted as well user frustration, C++ is the most harmful language in the history of humanity. Someday I'll put together a page listing the dozens of C++'s design daults. Here's just a single article demonstrating how incompatible with simplicity and correctness C++ is: http://www.icu-project.org/docs/papers/cpp_report/the_anatomy_of_the_assignment_operator.html http://www.icu-project.org/docs/papers/cpp_report/the_anatom...
- lenkite 7y agoI am completely the other way. Coming from Java, I am finding modern C++ pretty amazing tool for design. There are some amazing compile-time API's I can design which is impossible in other languages. Maybe the shiny will wear off after some time but so far I am loving it. I am truly looking forward to C++ 20.
- simias 7y agoC++ is pretty great in single player mode, you have so much power at your fingertips. It's the epitome of "and the kitchen sink too". It's when you switch to online multiplayer and end up having to maintain and modify code written by other people who have different opinions on how kitchen sinks should be installed and used that things tend to sour a bit.
- deleted 7y ago[deleted]
- dgellow 7y ago> in an effort to compete with Rust and Go I think that you overestimate how much Go and Rust are used in the wild, and how much of a threat they are to the C++ ecosystem. IMHO C++ is mainly competing with its own past.
- throwaway17_17 7y agoI genuinely believe statements like GP’s are a result of living in a cutting-edge tech bubble, not necessarily SV, but online hype and discussion based reality. Sure several large impactful projects use Go and a few companies are dabbling in using Rust. However, the number of these usages is dwarfed into near statistical irrelevance by the amount of C++ code in active production and usage (it is even more irrelevant if you count programs written in C). That is not to say there is nothing good or beneficial about these languages, devs using them are free to evaluate the features provided and find that they suit their use case and go get to work. But some dev’s pet language, no matter how loudly they scream on Reddit and HN, is not yet threatening C++.
- Darvon 7y agoI can't imagine a real world robotic assembly line in 2020 not using c/c++ indefinitely. Doesn't matter how cool the new language is, what people really want is to not have to rewrite that dependency they're still using from 1998.
- simias 7y agoYou can't fix C++ because the only thing there is to fix is to get rid of all the legacy baggage but doing that would break backwards compatibility (including probably compatibility with C) which means that it's not C++ anymore. "Fixed" C++, per your description, already exists. It's called D. It's called Rust. It's called C#. It's called Go. Meanwhile there appear to be many people who (I must admit much to my puzzlement) seem to still enjoy writing C++ and want to add even more features and paradigms to it. I wish them good luck and I'll be sure to look at the results from afar and see if I can recognize some bits of the C++ I used to write 15 years ago. Oh! I think I saw an "if"!
- blub 7y ago"It's called D. It's called Rust. It's called C#. It's called Go" All of these languages with the exception of D are completely different. It's like saying you fixed a cupboard by replacing it with a sofa. D's the most similar, but it's sadly not exactly a hot language or one where there's jobs available.
- bluejekyll 7y agoWas the cupboard being used as a sofa?
- The_rationalist 7y ago* rid of all the legacy baggage * It keeps being repeated over and over but where can I find such a list? There's almost no misfeature in c++. It's issues are just the fact it's too low level / manual.
- 72deluxe 7y agoHow is it too manual compared to eg C# where I need to implement IDisposable and wrap use of variables in "using" to really ensure something is cleaned up when I want it cleaned up (without risky memory ballooning relying on the GC)? C++ destructors to clean up your resources are really neat. And deterministic - you know when stuff is going to get cleaned up. Or was it some other "manual" feature that's too much of a burden? Honestly curious.
- 72deluxe 7y agoIn what way is C++ "deeply" broken? I seem to be using it daily with no problem, as does the rest of the world. I manage to use applications and operating systems where vast portions of it are written in C++ without problems - what problems are you having? Honestly, it's dead easy to criticise but you must be using the product of another language if you feel so strongly about this...? Tell me, which browser and operating system are you using to write this comment? It must be one written in something other than C++, right? Your browser isn't using WebKit or Blink by any chance is it?? Let's hope the web server or network appliances used to transfer the data to you are not using software written using this "deeply broken" language!
- jefftk 7y agoI mostly agree with you, but operating systems and web servers are generally written in C and not C++. For example Linux, (the vast majority of) GNU, Apache, and Nginx are all C. (Though I expect your parent has similarly negative views on C?)
- 72deluxe 7y agoYou are correct, thanks. My comment comes across as very irritated, but it's the same argument that will continue to the end of time I guess - "this tried, tested and widely used language is broken because it is not language $x and because it lacks this edge-case invented usage scenario even though it works adequately for 99.9% of all other scenarios as demonstrated by decades of use". It's wearying. Sure, C++ is complicated but so is English! I thought nginx was C++? I also thought large portions of Windows are C++? Everybody loves COM!
- bouncycastle 7y ago> an airplane engine from Rolls-Royce RR makes excellent aircraft engines, for both Boeing and Airbus https://en.wikipedia.org/wiki/Rolls-Royce_Trent https://en.wikipedia.org/wiki/Rolls-Royce_Trent
- gerikson 7y agoIn addition, Rolls-Royce cars are made by BMW now, who also make quite good engines.
- bouncycastle 7y agoCorrect. RR doesn't make cars anymore, it's only just a badge. Also, RR is dominating the marine propulsion sector, these engines are some of the largest in the world!
- gerikson 7y agoThis I did not know, interesting!
- endorphone 7y ago"yet instead of fixing anything they just pile up more features in an effort to compete with Rust and Go" Alternately they're iteratively evolving the language as each generation of features are fleshed out? They've been doing this for several decades now. It's their job. And for those people using C++ tooling, or working on C++ projects: Cool, new stuff to ease some edge conditions.
- pjmlp 7y agoAs much as I like Rust, progress usually comes in progressive changes, not with big bangs. Modern C++ is already a large improvement over C, which was already a 19th century carriage, when everyone was moving into steam cars.
- tsimionescu 7y agoUnfortunately, modern C++ still includes (the vast majority of) C, both in theory and in practice in many code bases around the world.
- pjmlp 7y agoIndeed, and it is its Achilles tendon, once its Trojan horse for adoption, nowadays the source of security headaches. However, I don't see many companies throwing away their IDEs, game engines, build systems just like that. It is easier to migrate those teams to static analysis tooling, than throwing it all away and start from scratch in another ecosystem. Hence why both Microsoft and Google are still two major contributors to ISO C++, in spite of being in the process of adopting Rust.
- stjohnswarts 7y agoCan you point out where Google and Microsoft are moving to Rust because I've seen none of that.
- steveklabnik 7y ago“Moving to rust” is too strong; they are both adopting Rust for real, production use cases. I’ll give you one example of each: Google is using Rust in ChromeOS, at the virtualization later, and Microsoft is using ripgrep to power the search for VS: Code. There’s more than just that but those are the two easiest things to point to.