JuliaLang/julia — pull request #4875 by StefanKarpinski (2013-11-21 00:13:41+00:00)
Title: WIP: Base.checked_{add,sub,mul} and overflow-safe parseint

We've had the intrinsics for checked arithmetic for a rather long time, we just haven't used it anywhere. This defines checked `+`, `-` and `*` the same way that we define `+`, `-` and `*` and uses it in parseint to prevent overflow when attempting to parse a too-large value.

This is still a work-in-progress because it has some issues:

- it doesn't work for `typemin(Int)`
- it doesn't work for "small" integer types like `Int8` or `Uint8`
- it needs tests