10 ms·
noob question: why is there still this sort of energy/effort put towards C++ when Rust is available? edit: thanks for downvoting a genuine question!
by jobs_throwaway 4y ago
noob question: why is there still this sort of energy/effort put towards C++ when Rust is available?
edit: thanks for downvoting a genuine question!
- gp 4y agoNot all organizations are in a position to make the switch or even want to. I personally like Rust and find it interesting, but that doesn't mean I would throw away my C++ codebase. I'm sure other people will be able to share reasons their organizations use C++
- thesuperbigfrog 4y ago>> I'm sure other people will be able to share reasons their organizations use C++ Rust is great and offers a great path forward, but it was not around 20+ years ago when $BIG_PROJECT was written. C++ was around, popular, and useful so $BIG_PROJECT was written in C++. $BIG_PROJECT made $BIG_COMPANY millions and is still in use today. $BIG_PROJECT engineers are looking into migrating parts of $BIG_PROJECT to Rust, but the work is still early and the $BIG_PROJECT's millions of lines of C++ won't be replaced overnight. Improved, more uniform tooling for C++ would simplify maintenance for $BIG_PROJECT and make it easier to move $BIG_PROJECT to newer C++ toolchains and even other C++ toolchain vendors. Maybe one day $BIG_PROJECT will migrate fully to Rust, or perhaps $BIG_PROJECT will be re-written from the ground up in Rust, but for now $BIG_PROJECT has to work.
- chad1n 4y agoI'm not a Rust apologetic, but even if the standard tooling committee appears, most big projects won't migrate to these tools, considering that they've been using some building scripts for 10-20 years and maintaining dependencies in hacky ways. These standard tools will mostly help new projects in C++ which can start from scratch and use vcpkg and whatever building tool will be selected (probably cmake or meson).
- bluGill 4y agoProjects will slowly migrate, as things are updated ' when a third party library release a version with this they will add support. When they need new features in their build system they will add them in this format, creating a weird hybrid until one day they turn the old stuff off.
- jcranmer 4y agoThere are a few things to note here. First, the hacky build systems of old are increasingly unsustainable; I've seen quite a few projects migrate to things like cmake in part because not having that kind of build system just doesn't work anymore. (And you get people like Mozilla or Google who write their own build system just for their software, but the end result is the same--you've got some sort of modern-ish build system being integrated). Even at $WORK, some of our old build system stuff with confusing make rules and the like is being shifted to a (hopefully) cleaner cmake stuff, albeit far more slowly than I'd like. Second, it's worth noting that tooling improvements can motivate change. The ur-example here is the compilation database idea Clang introduced. From what I've seen, every build system that can support it (sorry, autotools) has added information to extract this useful tool. If you can come up with similarly useful build system summary information that is useful for tooling, you're likely to see relatively swift adoption of it. Third, C++ is already undergoing changes that will introduce build system breakages. Most notably and obviously, modules. Build systems need to adapt to support this, and if people are already making the switch to get new features, incorporating other useful tooling additions at the same time would see adoption.
- cyber_kinetist 4y ago> I've seen quite a few projects migrate to things like cmake in part because not having that kind of build system just doesn't work anymore The problem is that CMake is also a cardboard castle built on numerous hacks that break every time a wind blows by. For library users it might be bearable, but for library writers it is absolute hell. And the consistent churn of new half-baked features and subpar documentation really doesn't help. (People talk about "modern" CMake like they do with "modern" C++, the churn is so similar...) The solution that I've found now is: I've built my own build system in Python that outputs a Ninja file, dead simple. Don't really have the urge to use CMake again (unless when I need to at $WORK)
- jimbob45 4y agoThere exist codebases that are too large and too old to ever adequately rewrite. Joel Spolsky wrote an entertaining article some time ago on why rewriting software isn't always the panacea it's made out to be[0]. [0] https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/ https://www.joelonsoftware.com/2000/04/06/things-you-should-...
- jcelerier 4y agoRust doesn't have Qt
- gavinray 4y agohttps://github.com/rust-qt https://github.com/rust-qt
- rvz 4y agoNot only those are rudimentary unofficial bindings but that looks unmaintained and is already out of date. Last updated 2021. So no. Rust does not have official Qt support.
- juunpp 4y agoIt's surprising to me that this was downvoted. Many a Rust project pulls several hundred Cargo dependencies that the developer probably hasn't even checked against basic things like outstanding bugs. The lack of standard package management in C++ sometimes is for the best.
- jcelerier 4y ago> https://github.com/rust-qt/examples/blob/master/widgets/basic_form/src/main.rs#L27 https://github.com/rust-qt/examples/blob/master/widgets/basi... this is ridiculous. rust does not have overloading ?
- josephg 4y agoNope! Rust doesn’t have function overloading like C++. What would that code look like in C++? (Rust has operator overloading - but that’s not the same thing).
- jcelerier 4y agohere's the code translated to C++: https://gist.github.com/jcelerier/f76e3ee55037675db559e5062f7bd5bf https://gist.github.com/jcelerier/f76e3ee55037675db559e5062f... Rust certainly brings a lot, but I would really doubt of the sanity of anyone who would take the rust code over the C++ one here
- deleted 4y ago[deleted]
- otabdeveloper4 4y agoRust doesn't solve any real problem. It's a meme language that is only used for writing blog posts and internet commentary.
- hoten 4y agoI suppose Figma is a meme company sold for meme dollars? https://twitter.com/figma/status/991697942070333447?lang=en https://twitter.com/figma/status/991697942070333447?lang=en
- otabdeveloper4 4y agoUnironically yes.
- pjmlp 4y agoThe money maker WebAssembly part on the browser is still C++.
- Karellen 4y agoSo, Linus Torvalds, who rejected calls for code written in C++ to be accepted into the Linux kernel for decades because he thought that the extra features it provides were not worth the added complexity it would bring, has decided to allow Rust support in Linux because... he suddenly got infected with brain worms that made him want to be a crowd-following blogger writing commentary for internet upvotes? And not because he thinks Rust might be able to solve actual problems in kernel development? I want whatever drugs you're taking.
- fluoridation 4y agoTo be completely honest, I would wager it was more a matter of ego than anything rational. C++ kept improving over time and he knew that, but rather than revise his position and admit to an error, he stubbornly persisted until Rust came along, and that gave him an out. "Well, C++ is too shitty; but Rust, a language that has not been around for even a decade, that's was I want to add support for in the kernel". Rust has pretty much all the failings he accused C++ of having, it just has memory safety as an additional benefit.
- adamdusty 4y agoYou're getting lots of explanations for why people don't switch to rust, mostly existing projects, but I'd like to point out that plenty of people still start new projects in C++ as well. Most game dev has to be c/c++ if you want to release on consoles. This isn't technically true, but in practice it is most of the time. Not everybody wants to program in rust's pseudo-functional style. Some people like C because if you can generally map nice C code to its assembly in your head. In my opinion, memory safety also gets a little overblown. Most applications don't really need memory safety, and for the ones that do, C++ smart pointers are good enough. I'm sure plenty of people will have strong opinions against that. Ultimately there is this sort of energy towards c++ because there are orders of magnitude more projects and developers that use C++, and it would be silly to stop work on C++ every time a C++ killer came along.
- TillE 4y ago> Most game dev has to be c/c++ There are certainly a number of high-quality C libraries hanging around (SQLite, libcurl, etc) that might be used, but I don't think anyone's doing serious game dev in C these days. It really is all about C++, and C# for Unity.
- PointyFluff 4y agoFor all it's faults. C++ (along with other languages) already has an international standards body. While a language made by committee is invariably garbage (citation: JavaScript), there is something to be said for stabilizing the standard for safety-sensitive systems like flight, space, medicine, automotive, and the ilk. Not a grate look if your space-balloon goes over like a lead-balloon. Also, Rust is not something you can just "switch" to; it's not javascript or python. You have to UNLEARN a lot of bad nuns before you can truly be productive in Rust. Learning rust is a steep climb, coming from languages like C & C++; if you are coming from a language like python or lisp, it's a damn near smooth-vertical-shaft. Frustratingly, a lot of the books for newbs are like: "So you wanna do this cool thing in Rust? Then do this tutorial project for this crate!", and they don't actually go over idiomatic rust algorithms. The way rust handles code and data, lends to "different" ways of solving problems. The best way to learn rust, is to read rust, but that can get confusing with the traits and typing bounds and lifetimes and unwraps. On the other hand you get to say "turbofish" a lot; so there's that, which is nice. And so the issue becomes one of monkey-power. I can find bucket-fulls of hairless apes to bludgeon in C or C++ code, but it takes a more sophisticated `Ook<T>` to see the Octarine that is Rust.
- tialaramex 4y ago> For all it's faults. C++ (along with other languages) already has an international standards body. Not everybody in the C++ community is convinced this is a benefit.
- kazinator 4y agoC++ has an international standards body without self-restraint and good taste, and one which cannot fathom the idea that its own discontinuance could be of benefit.
- Mikeb85 4y agoC++ can be more pleasant to write than Rust, especially if you limit yourself to modern features, OO-style, etc... It's also extremely mature, has a library for everything, is on every platform known to mankind, etc... C++ has a lot of baggage and if you maintain old C++ software I'm sure it's a massive PITA but starting fresh in C++ isn't a bad experience.
- FpUser 4y agoThe simples answer is that many orgs have accumulated megatons of high quality production code that cost them unknown billions in total to create and that runs half of the world. Throwing it away is insanity. Hence need to improve on what is already available. Also not everyone believes in silver bullets and modern C++ is fairly god and easy enough to use. Just do not try to know ALL of the C++. This kind of expertise is needed by whole 2.5 people. Partially true for any complex enough language. You are still more than welcome to start new projects in whatever language warms up your heart or rewrite already existing stuff. P.S. I do not ever downvote post no matter what does it say.
- scrubs 4y agoWhy? Either (1) you have so much c++ that moving it rust is a waste of money; we have 10s of millions loc (2) you need access to 3rd party lib in the eco system not native rust (3) c/c++ builds are a pain in the butt. Even if one was sick of c++ and like rust it's for new stuff, not maintenance of existing c++ stuff