3 ms·
Are there really any good reasons to start a brand new project in c++ though? No one who can write modern c++ has any trouble with rust in my experience, and al
by galangalalgol 9mo ago
Are there really any good reasons to start a brand new project in c++ though? No one who can write modern c++ has any trouble with rust in my experience, and all the other common options are even quicker to pick up. Creating bindings isn't hard anymore if your niche library doesn't have any yet. Syntactic preference I guess, but neither c++ or rust are generally considered elegant or aesthetic choices.
- BearOso 9mo agoRust becomes a significant burden if you need a GUI or hardware-accelerated graphics.
- jenadine 9mo agoC++ isn't much better for GUI.
- johnny22 9mo agoI assume most of them are just grabbing qt
- pjmlp 9mo agoC++ was the GUI king during the 1990's, and none of the Rust toolkits is half as good as the surviving frameworks, like C++ Builder, Qt, wxWidgets, heck even MFC has better tooling.
- LexiMax 9mo ago> wxWidgets I'll trade you wxWidgets for FLTK. Trying to defer to native widget rendering per platform was a mistake, and every time I've touched wxWidgets in the past decade and a half I've regretted it. FLTK on the other hand is ugly as sin, but I've found it reliable enough to not act in surprising ways, and it's also small enough to where you can vendor it and build it alongside your program.
- CamperBob2 9mo ago(Shrug) If I want Rust, I'll feed my C++ to an LLM and tell it to port it to Rust. Since we've been assured that Rust magically fixes everything that's wrong, bad, or unsafe about C++, this seems like a sound approach.
- galangalalgol 9mo agoWe probably aren't that far off actually. Even taking asm with no symbols back into rust works well. You have truth, just have the agent repeat until the asm matches. Doesn't work on giant codebases, but on a few functions it absolutely does. And while the llm may get the algorithm wrong, the type system does seem to help it generate useful code in rust for a starting place v
- pjmlp 9mo agoYeah, but then just let the agent generate proper C++ code, contrary to an human it doesn't forget about best practices, or how ownership is supposed to be handled.
- galangalalgol 9mo agoExcept the llm forgets about that in rust too, then the agent looks at the ownership errors from the previous iteration and fixes them.
- pjmlp 9mo agoFirst it needs to have a Rust ecosystem available, e.g. CUDA, SYSCL, HFT, HPC,... Maybe it could be used to remove Rust dependency on C++ infrastructure (LLVM/GCC), and bring Cranelift up to speed.
- pjmlp 9mo agoYou missed the other take, with AI assisted coding, you can stay in C++, as it will take care everything is coded with enough care. Or why bother with Rust, when the LLM gets to generate C++ code with best practices. While I like Rust, I think AI as the next abstraction step in programming has kind of taken its relevance away, when computer assisted programming is part of the workflow.
- cpgxiii 9mo agoBecause "brand new" doesn't mean devoid of context. Within your domain, there will still be common libraries, interfaces, and tools. C++ is very flexible, with a lot of very mature tooling and incredibly broad platform support. If you're writing some web server to run on the hardware of your choosing, then sure, that doesn't matter. But if you're writing something deeply integrated with platform/OS interfaces, or graphics, or needs to support some less common platforms, then C++ is often your only practical option for combining expressiveness and performance.
- galangalalgol 9mo agoThis is the sort of info I was trolling for, but what are those platforms and os? Targets llvm doesn't handle yeah c++ makes sense, or c. A sibling mentions xcode, which makes sense. Graphics seems questionable, vulkan support is fine. Windows support has seemed finetoo, the same gui has worked as what we wrote for Linux.
- jupp0r 9mo agoDependencies. There are billions of lines of C++ out there that have been optimized and production hardened over decades that you might want to reuse. Rust lang interoperability with anything but C sucks in practice.
- pjmlp 9mo agoUnreal, Godot, CryEngine, DirectX, PlayStation, Switch, XBox, CUDA, SYSCL, LLVM, GCC, V8,...
- kstenerud 9mo agoYes. If you're targeting Apple platforms and want to allow clients to use your product in Xcode (the common case) or even need Swift/ObjC interop yourself, using rust or anything not explicitly supported by Apple and Xcode is just too fiddly.
- galangalalgol 9mo agoWhy not pick swift in this situation over c++?
- deleted 9mo ago[deleted]
- bigstrat2003 9mo agoMaybe, maybe not. But either way it's just plain rude to charge into a C++ thread to drop a comment saying how the language sucks and you should use (insert other language) instead.
- jenadine 9mo agoIn addition to other reasons given: If you have a team of C++ developers, let them use the language they know best.
- pjmlp 9mo agoYes, there are plenty of domains where Rust has zero ecosystem. Not to mention that Rust advocates keep forgetting their compiler is partially written in C++ (LLVM/GCC).