2 ms·
While unsigned arithmetic is not "enabled by-default", a simple `import unsigned` and you have it. If you want the language to handle overflows for you, you ca
by def- 12y ago
While unsigned arithmetic is not "enabled by-default", a simple `import unsigned` and you have it.
If you want the language to handle overflows for you, you can enable runtime overflow checks for your whole code or any specific part of it.
Otherwise, if you opt for no runtime checks and release builds with all optimizations, you indeed go into the same undefined behaviour territority as in C, so you'd have to prevent overflows before they happen.
- halosghost 12y agoI understand that it is available simply; I was questioning the logic of having it disabled by-default. Having the ability to do run-time checks for {over,under}flow does seem to make this issue a little better but doesn't explain the logic of having the language prefer UB by-default. Yes, C does this too (integers are signed by-default), but if I'm shopping for a language that abstracts C, I'm probably looking for improvments over C's defaults.