Hacker News new | past | comments | ask | show | jobs | submit login

It has controllable behavior, explicit APIs to pick the precise behavior and there is no undefined behavior with regards to overflows which greatly helps with memory safety.



It is controllable in real C compilers too (i.e. -fwrapv, -ftrapv GCC options), so you can make them silently ignored or cause trap. Real problem with integer overflows is that they are logic errors that are hard to check in compile-time, and neither C nor Rust helps with preventing them.


I’m not sure that’s true but I also don’t have data on this. In my personal experience the issue with integer over-/underflows mostly played a role when those integers were used in branching or memory indexing. The rules around UB with overflows are really messy and those issues definitely do not exist in Rust.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: