warning: comparison of constant -2147483648 with expression of type 'long' (range [-2147483648, 2147483647]) is always false [-Wtautological-constant-out-of-range-compare]
As int and long maybe the same size on most architectures, the test doesn't really tell if the value is out of range or not.
The fix changes to "long long". But may still not the best way as there is no guarantee that it would be bigger than int.