| ▲ | LegionMammal978 14 hours ago | |||||||||||||
> But what about the range? While it’s true that you get twice the range, surprisingly often the code in the range above signed-int max is quite bug-ridden. Any code doing something like (2U * index) / 2U in this range will have quite the surprise coming. Alas, (2S * signed_index) / 2S will similarly result in surprises the moment the signed_index hits half the signed-int max. There's no free lunch when trying to cheat the integer ranges. | ||||||||||||||
| ▲ | lerno 13 hours ago | parent [-] | |||||||||||||
The difference is that in the unsigned case you get a seemingly plausible value, and in the signed case you get a negative value which you can be sure is wrong. This is the problem. | ||||||||||||||
| ||||||||||||||