Open CybCom opened 2 months ago
The example is intentionally designed to show behavior that would be unsafe in any language, since it's at the very beginning of the section.
Under this example the book states the advantage of rust over interpreted langs, and I just want to also show its advantage over other compiled langs by editing the example😂
I was reading here and I don't think the code here would be a good example for demonstrating the safety of rust.
Yes, this code is not safe if allowed to run. However, use a variable without declaration will cause an compiling error in most languages (java, c...) rather than only rust. And its also not complex to check.
Maybe this,
use a variable uninitialized will be a better example to explain the concept of undefined behavior.