Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

While this is true on the machine level, it also really depends on your programming language.

Certain languages like Python or Ruby automatically convert a smaller integer type to a larger, unbounded one. Other languages like Swift (or Rust in debug mode, I believe) prefer to throw an error upon integer overflow instead of silently wrapping. I believe that the silent wrapping behaviour in e.g. C and Java is a decision that prioritises performance over safety, as this is behaviour that you rarely want, and if you do, there should be better ways of expressing it.



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

Search: