Re:I cannot consistently write safe C/C++ code
by Rusky on Monday July 17, 2017 @12:59PM
(#14790350)
These cases are not subtle at all. You can understand a good number of them with barely the knowledge from an Intro to Java class- iterator invalidation, data races, etc.
There is no need to understand the particulars of C or C++ to do or appreciate safe systems programming.
Re:I cannot consistently write safe C/C++ code
by alfiedotwtf on Monday July 17, 2017 @07:12AM
(#14787384)
I'm talking safe as in Rust's memory safety guarantees.
Re:I cannot consistently write safe C/C++ code
by ccommsxx on Monday July 17, 2017 @07:29AM
(#14787507)
As far as I understand, there is no accepted formal specification or even single source of truth for what the rust community thinks are the "rust memory safety guarantees". Only a large number of people that have completely convinced each other that "it's better than C++" with little proof and without even clearly defining their own semantics. Please correct me if I'm wrong here (a blog post does not qualify as a specification).
Re:I cannot consistently write safe C/C++ code
by steveklabnik on Monday July 17, 2017 @11:41AM
(#14789549)
It's a little more subtle than that: It's "safe code must be memory safe" and "unsafe code infects the whole module". The stuff you're talking about is "what exact invariants are unsafe code supposed to uphold". Because unsafe Rust is a superset of safe Rust, that being an open question does not mean that what's meant by "Safe Rust" inside of safe Rust is up for questioning.
Work on exactly what unsafe code is expected to do is ongoing.
Re:I cannot consistently write safe C/C++ code
by Rusky on Monday July 17, 2017 @12:57PM
(#14790329)
It's nowhere near that uncertain. "Memory safety" is hardly a subtle property and it's been well-understood since we figured out how to enforce it in garbage collected languages.
The only uncertain part is which rules unsafe code has to follow to maintain it- it currently comes down to "whatever LLVM optimizations won't break," which is in practice what C and C++ programmers deal with already. Things like your link are work to improve the situation beyond C and C++.
[dead]
Comments like these aren't OK on Hacker News, no matter what you're replying to.
But yes, rust could turn out to become a new widely accepted standard for systems programming some day and depending on whether you believe that or not, it might make sense to "invest" your time into it.