3 ms·
Another day, another memory violation... the endless supply of ammo dispenses another box of shells for Rust. I don't know if Rust is the future, but I am cert
by topspin 11y ago
Another day, another memory violation... the endless supply of ammo dispenses another box of shells for Rust. I don't know if Rust is the future, but I am certain the dangling pointers, use after frees, buffer overflows, double frees, smashed stacks, ignored failures, uninitialized data and all the other horrors of contemporary C/C++ will one day be understood as intolerable.
- JoeAltmaier 11y agoThese things can be reduced to nuisance level by discipline. The cost to obviating them by language design is not zero (code size; execution speed; random latencies) so its arguable, different languages, different purposes.
- aschampion 11y ago> These things can be reduced to nuisance level by discipline. Obviously not. We've been doing this for decades and are still making the same mistakes with costly effects. Humans are as much a part of technological systems as the language or platform; continuing to ignore that even educated, disciplined, skilled developers are prone to certain classes of errors -- errors that could be obviated by other components of the system -- is hubris. It is much more feasible to create tools that exclude certain classes of error than to create less fallible developers. > (code size; execution speed; random latencies) Rust is not GC'ed, has no inherent reason to be slower than C (as the toolchain matures), and I doubt is more verbose than C code that provides the same safety.
- JoeAltmaier 11y agoSpeak for yourself. A power saw is dangerous; but I'm not going back thanks. And nothing to say about the performance cost of these infallible tools? They are not free.
- kbenson 11y ago> A power saw is dangerous; but I'm not going back thanks. And now we have power saws that immediately stop when they encounter flesh. Obviously, disciplined users never had to worry about that system, otherwise we would have had a bunch of people missing fingers... like my wood shop teacher in high school. :/ > And nothing to say about the performance cost of these infallible tools? They are not free. People have brought this up a few times, but I've never gotten an explanation that makes sense. My understanding is that Rust does most of its protections in the compile stage, so while not free, they are a small up-front cost at the compile stage, plus an indeterminate cost at the development stage in possible more complex reasoning about the code, which then pays off over the lifetime of the application. While not free, that's definitely a trade-off that seems to make sense to me. Or are you talking about some other cost? Can you explain where I'm not understanding your point?
- unscaled 11y agoRight, except that Rust is a modern power saw with safety enclosure and C is a rusted chainsaw that only works half of the time.
- wepple 11y ago"only works half the time" is a bit of a stretch. what's your OS kernel written in? I agree we could do better than C. Everyone here talks about it every time this happens, but does nothing. I'll take battle-hardened C over written-last-week Rust, too. Especially crypto code.
- pjmlp 11y ago> These things can be reduced to nuisance level by discipline. Apparently 40 years are not enough to acquire that level of discipline.
- JoeAltmaier 11y agoMy teams have written hundreds of thousands of lines of C++, with only occasional (once a year?) trouble with reuse-after-delete or double-delete. And their are tools to deal with that. We've enjoyed orders of magnitude performance and latency improvement over scripted or GC'd languages. Its certainly possible to write competent C++ with a professional team, and clear reasons for doing so.
- pjmlp 11y agoFirst of all the issue is mainly with C, not C++. C++ does provide the necessary features to write safe code, as long as one stays away from "C with C++ compiler" mentality and adopts those language and library features. As for the tools, they are largely ignored by the majority of enterprise developers, assuming Herb Sutter's presentation at CppCon 2015 is in any way representative (1% of the audience said they were using them). Which goes in line with my (now) outdated C++ professional experience up to 2006. Only one company cared to pay for Insure++ (in 2000) and I was probably the only one that cared to have it installed. Also except for my time at CERN, I never met many top elite C++ developers. Most were using it as "C with C++ compiler" and in teams with high attrition, leading to situations where no one was 100% sure what the entire codebase was doing.
- asddubs 11y agocontemporary C++ doesn't really have these problems if you do RAII