4 ms·
Data races are possible in memory managed languages. And segfaults are thrown over the fence to the runtime. I'm sure anyone who has used Java in anger has seen
by fnord123 9y ago
Data races are possible in memory managed languages. And segfaults are thrown over the fence to the runtime. I'm sure anyone who has used Java in anger has seen segfaults. I certainly have.
Personally, I think the statement is too strong. Rust is not immune to these things as the compiler is victim to all the realities of software development that all projects face. But it certainly does dramatically reduce the bug vectors.
- wuch 9y agoYeah, I suppose for the end user I doesn't matter if program stopped working because of segmentation fault or a panic. Though, if one were to choose on of those issues, then obviously runtime errors are preferable over memory-safety problems that might lead to an arbitrary code execution. BTW, in Java data races do not cause undefined-behaviour. In fact there is no undefined behaviour in Java at all (as specified at least, in practice as you and many others have observed things may work quite differently).
- mort96 9y agoWho said anything about UB? You can easily fuck up a parallel program in a nondeterministic may without UB. If two threads are in a deadlock, each waiting for the other thread to release a resource it needs, nobody cares that it wasn't caused by UB.
- the8472 9y agoJava as specified is memory-safe. It cannot cause application-visible segfaults (hotspot uses segfault handlers internally for some trickery but that's not really relevant here). Of course bugs in the JVM, native libraries or things like sun.misc.Unsafe might. But that's no different for rust, once you start using unsafe or use C libraries things might explode.
- aaron_m04 9y ago> Personally, I think the statement is too strong. Rust is not immune to these things as the compiler is victim to all the realities of software development that all projects face. But it certainly does dramatically reduce the bug vectors. The Rust compiler is extremely good at preventing undefined behavior in code that's not being written maliciously. You really can't encounter one by accident.