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

That's the behavior you get in Zig, if you declare a variable of type `u31`: an unsigned 31-bit integer that's implicitly convertible to `u32` or `i32`.

Also in Zig overflow is illegal for both signed and unsigned integers, and guaranteed to be detected when building in Safe mode (but not in Fast mode). There is a separate set of operators for wrapping arithmetic.



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

Search: