On 4/2/2013 12:47 PM, Andrei Alexandrescu wrote:
I used to lean a lot more toward this opinion until I got to work on a C++ codebase using signed integers as array sizes and indices. It's an pain all over the code - two tests instead of one or casts all over, more cases to worry about... changing the code to use unsigned throughout ended up being an improvement.
For example, with a signed array index, a bounds check is two comparisons rather than one.
