I’m not trying to be snarky, but the thread was about Rust as an improvement to C and you just threw C++ into the mix... which isn’t as safe.
I’m not trying to be snarky, but the thread was about Rust as an improvement to C and you just threw C++ into the mix... which isn’t as safe.
[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus/blob/master...
[2] https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...
One could go to almost safe C++ because C code compiles with a minimum amount of changes and turning on compiler warnings, using vector, string and smart pointers already gives a massive saftety improvement, without a complete rewrite in a language that's quite different from C, like Rust is.
Smaller costs and still significant benefits in other words.
I was referring to the thread that started a conversation about pointers and safety in Rust, not to the general post.
You are correct that C and Rust require some more bridging between the languages, but C++ also requires this when going from objects to C datatypes and vice versa. Mostly you save a little bit on the header definitions, but even there, the headers are generally #ifdef'ed to almost illegibility. With Rust's bindgen tool, getting C headers into Rust is actually quite easy: https://rust-lang-nursery.github.io/rust-bindgen/
The bindgen tool allows integrating C code with Rust code, which means than an existing C code base can be replaced with Rust step by step.
A C code base can be compiled with some modifications as C++ and then it can be slowly refactored to use safer C++ idioms. In this case the safety improvements will be available much faster, even if the resulting code base won't be as safe as a Rust code base. The culture shock will also not be as large for the C programmers.
These are non-negligible benefits, and a big reason why C code bases are moving to C++.
Which recently passed a milestone of having less C than Rust: https://www.reddit.com/r/rust/comments/8ofa0w/librsvg_has_no...
At this point I personally find it much easier to move C to Rust than C++, and end up with a much safer codebase.
However that doesn't prevent copy-paste C code from team mates, only languages that aren't C compatible do provide such additional safety.
Not claiming to be an expert in C, but I paid my share of blood and tears with it, and all I can say is that it's worth the effort to learn Rust for the huge guarantees the language gives you in the same contexts as C.
If you're interested in baremetal, there are a number of tutorials out there, all focused on different things. I really love the TockOS tutorials, they are really awesome for getting across some of the different benefits at different levels: https://github.com/tock/tock/tree/master/doc/courses/rustcon...
And then more raw OS stuff: https://os.phil-opp.com/
For GUI software or GPGPU development, it still needs to mature a bit more.
I mostly think this is a gap in common libraries at the moment and decent coding practices. We’ll see what happens with all of that.
Personally I’m more focused on web-backends, micro-services, and DNS, so GUIs don’t generally present problems for me.
I do agree though that it might need still some ergonomic improvements to earn the hearts of other developers that don't share this opinion.
Many of the Rust users have all gone through similar learning hurdles, and are very helpful when asked. Often there are tricks that newcomers are unaware of for working around some of the Rust idiosyncrasies. I encourage you to reach out.
The official community page has a lot of resources: https://www.rust-lang.org/en-US/community.html