I like that one. Anyone know any widely adopted languages that do this?
I like that one. Anyone know any widely adopted languages that do this?
Overflow checking is a bit more rare:
* Swift has it by default (error)
* So do Python, Ruby, Erlang (promotion to arbitrary precision)
* C# has an optional Checked Context though I don't know how common it is
* Rust has checked operations (opt-in, both error and saturating), will check (error) by default in debug mode, it can optionally check (error) in release mode
It is a pretty special case though, you have to jump through a number of hoops using dependent types to get it.
Indeed it does, but I'm guessing it doesn't come close to qualifying for "widely adopted language", my list is already stretching it.
GCC: https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins...
clang: https://clang.llvm.org/docs/LanguageExtensions.html#checked-...
C# has the ability to opt-into default checked arithmetic. I don't know of anyone that uses it...