3 ms·
> I'm honestly befuddled why anyone would downvote this. I think there's two parts to this. First, there's a bit of a history of people making disingenious jab
by ben0x539 2y ago
> I'm honestly befuddled why anyone would downvote this.
I think there's two parts to this. First, there's a bit of a history of people making disingenious jabs at Rust for not having an "ISO C++" style spec. Typically people would try to suggest that Rust can't be ready for production or shouldn't receive support in other ecosystems without being certified by some manner of international committee. Second, Rust by now has an extensive tradition of people discussing memory safety invariants, what soundness means, formal models of what is a valid memory access, desirable optimizations, etc, etc, so your question what undefined behavior means could be taken to be, like, polemically reductive or dismissive.
In context I don't think it's what you're doing, but I would also not be surprised if a lot of people reading Rust-related HN discussions are just super tired of anything that even slightly looks like an effort to re-litigate undefined behavior from first principles, because it tends to derail more specific discussions.
- NoTeslaThrow 2y agoTbh, I just really hate the term "undefined behavior". It really feels like laziness in terms of what the possible damage might entail.
- arlort 2y agoIt is a term of art in compilers/language design though, isn't it? If you break an invariant the compiler is relying on for optimization then you can't say for sure what the effect after all optimisation passes or in future versions of the compiler will be. It's just "undefined"
- imtringued 2y agoYeah I personally think the problem isn't undefined behavior itself, but the C development culture where undefined behavior is sprinkled all over the language to the point where it has become unavoidable plus the inevitable assignment of blame onto C developers, because everyone knows there is enough time in the day for fuzzing your entire code base.
- Dylan16807 2y agoIn a situation like this, causing UB is basically saying you deliberately corrupted your memory. How are you supposed to be specific about what the possible damage might entail for corrupted memory? If you have a function with an "if" or a "while" or a "switch" in it, and you break the variable being evaluated, you might cause the program to skip over the choices and run whatever happens to be next in memory. What's the non-lazy listing of possible outcomes at that point?
- zozbot234 2y ago> Second, Rust by now has an extensive tradition of people discussing memory safety invariants, what soundness means, formal models of what is a valid memory access Rust is still lacking a definitive formal model of "soundness" in unsafe code. I'm not sure why you're suggesting that this is not a valid criticism or remark, it's just a fact.
- ben0x539 2y agoShowing up out of nowhere pretending like they haven't even thought about what it means isn't helpful though.