3 ms·
> can do everything that C++ can There are still areas where C++ is more expressive than both rust and go. AFAIK rust just recently got the capability to work
by steerablesafe 6y ago
> can do everything that C++ can
There are still areas where C++ is more expressive than both rust and go. AFAIK rust just recently got the capability to work with const generics and compile time evaluation.
Lack of overloading (besides operators) in Rust is a double edged sword. Overloading allows for very expressive C++ code in the expense of awful error messages when it doesn't work out.
C++'s concurrency story is continuously improving, but I'm not qualified to compare here. C++20's coroutines will be quite powerful.
And there is one area where Rust and go can't compete: interacting with existing C++ code, including templates. There is a lot of that already.
Having said that I keep a close eye on rust, it can certainly replace C++ in certain areas, possibly all areas in the future. But it can't replace it overnight, considering that there are millions of lines of _maintained_ C++ code out there.
Not go though, that's like comparing apples to oranges.
- bluejekyll 6y agoI think this is probably the most important reason you list: interacting with existing C++ code, including templates. I wonder if we could ever get direct Rust to C++ FFI. There are ways around it of course, by dropping down to C FFI in both languages.
- cptroot 6y agoIt's important to remember that C++ doesn't define an ABI, so you'd have to focus on specific compilers' ABIs.
- bluejekyll 6y agoFor some reason I thought C++ had gotten a stable ABI? Not sure why (I’ve been out of C++ dev for years).
- pornel 6y agoC++ has a policy of not making changes that would break anyone's ABI, but still doesn't have an official one. https://cor3ntin.github.io/posts/abi/ https://cor3ntin.github.io/posts/abi/
- d1zzy 6y agoThere isn't any standard C++ ABI but there is a de-facto standard ABI that many compiler writers have agreed upon (icc, clang, gcc), funny enough it was developed for Itanium originally: https://itanium-cxx-abi.github.io/cxx-abi/abi.html https://itanium-cxx-abi.github.io/cxx-abi/abi.html
- nindalf 6y ago> I wonder if we could ever get direct Rust to C++ FFI https://github.com/dtolnay/cxx/ https://github.com/dtolnay/cxx/ exists and works well AFAIK. That's what Chromium (https://chromium-review.googlesource.com/q/project:experimental/chromium/src+branch:refs/wip/rust-experimental-branch https://chromium-review.googlesource.com/q/project:experimen...) and others use.