Best practice is to either
Use sensible types in your system. Be aware that a machine int is not a mathematical integer. If your program may need to use numbers out of the range of a machine int, you should be using a big integer library, not machine ints.
Program defensively. If an operation might result in a value going out of range, then you should explicitly check for this after the operation is performed (or, even better, check before the operation to see if the arguments will cause an error).
Of course, if you do 2. you still have to decide what to do in case an error occurs, which you don't with 1. However, using big integers will incur a performance penalty in most languages. Whether that runtime penalty is greater or less than the penalty from performing safety checks will likely depend on the programming language and the specifics of your program.
In the end, it is the programmer's job to be responsible with the code that they write. The language can only provide you with so much help.