4 ms·
That's the problem, if one int is negative and the other is positive, (high - low) may overflow.
by mojuba 17y ago
That's the problem, if one int is negative and the other is positive, (high - low) may overflow.
- amalcon 17y agoIn this particular context, however, that should be just fine: low is clearly initialized to zero, and then only set to the value of this expression +1. As such, barring other bugs, low can never be negative. Your point is valid, though, and worth bearing in mind in other circumstances.