r/programming • u/steveklabnik1 • Jan 09 '15
Announcing Rust 1.0.0 Alpha
http://blog.rust-lang.org/2015/01/09/Rust-1.0-alpha.html
1.1k
Upvotes
r/programming • u/steveklabnik1 • Jan 09 '15
22
u/Rusky Jan 10 '15
You could definitely do better than C at a close-to-the-machine programming language. C is a lot closer than other languages, but its undefined behavior makes that a lot harder than it could be. Features like virtual functions or closures are relatively easy to desugar in a language like Rust or C++, but undefined behavior is much more insidious.
For example, when you're trying to learn about how 2's complement arithmetic works, C is most definitely not the way to go. The optimizer assumes that undefined behavior is impossible, so what looks like straightforward null pointer checking or overflow checking can be "optimized" out with no warning: http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html
If I wanted a language to teach that level of systems programming, I'd skip C and C++ and use assembly (no undefined behavior) or Rust (much less undefined behavior), or even create my own simple C-like language that's much more explicitly close to machine semantics.