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

> Isn't uint8 exactly what your 'integer[modulo 256]' is

In c/c++ it is. Obviously some other languages would disagree.

I think a better example of what GP is thinking about is Rust's approach, where overflowing an u8 panics (in debug builds), but you can do x.wrapping_add(y), x.saturating_add(y), x.checked_add(y) etc., depending on what you want to happen when the operation overflows.



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

Search: