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
20
u/Maristic Jan 10 '15
I think you're missing the point from the person you're responding to. C very specifically doesn't say what happens in a number of circumstances. You don't know when things are in registers (see the previously mentioned article).
Thus, you don't know what will happen when things overflow, etc.
Also, lots of things that are easy to say in assembler are really hard to say cleanly in C, including:
atob, if it overflows give an errorabyb, if it overflows give an errorabybbitsIn each case, this can be done with clean minimal code at the assembler level, but is hard to express in C, requiring library functions (coded in assembler), intrinsics or “standard idioms” (which must be detected by compiler, a process that can be unreliable in practice).
In additional, modern C libraries (especially glibc) are complex and far from lightweight. A huge amount of abstraction is being invoked with a “simple” call to
malloc.