3 ms·
>I always wondered if in practice it really checks out, is rust code really safer? Did the bugs just shift to different ones? Bugs don't magically "shift". If
by coldtea 8y ago
>I always wondered if in practice it really checks out, is rust code really safer? Did the bugs just shift to different ones?
Bugs don't magically "shift". If you eliminate a class of bugs, it's gone (e.g. memory bugs).
Whether you can still have other bugs (e.g. logic bugs) that's irrelevant, you could still have those in C as well.
- davrosthedalek 8y agoOr, the way you eliminated one class opens up or makes more likely a different class. Maybe avoiding pointers makes it more likely to introduce logic bugs. It could also make some algorithm too slow, which one could call a performance bug. I don't think it's particular likely, but there are always trade-offs.
- pjmlp 8y agoAs proven by Ada, Modula-2 and a few other systems languages, you don't need to scatter pointer arithmetic all over your code to achieve the same machine language output.
- tzahola 8y ago>Bugs don't magically "shift". It depends... You can’t have dangling pointers in Java - instead, you can “leak” memory by holding onto your objects even when they’re not needed anymore.
- elteto 8y agoI don't think you are using "instead" correctly in that sentence. You are implying that not being able to have dangling pointers in Java (and thus eliminating an entire category of bugs) inevitably leads to the new category of bugs of leaking memory by holding on to references. But that is the case in any language that allows dynamic memory allocation. You can leak memory in Rust, C++ and VB if you don't dealloc.
- Dylan16807 8y agoA program with more memory controlled by GC is generally going to have more leaks like that. The switch reduces bugs some, and definitely reduces the severity, but I would largely put the bugs in the same category and say it hasn't been eliminated.
- coldtea 8y agoPart of my point would be that you can have that in C as well.