3 ms·
One thing with array indices is that using signed means that you need to always check for negative in addition to checking for too large. Unsigned indices means
by InfiniteRand 5y ago
One thing with array indices is that using signed means that you need to always check for negative in addition to checking for too large. Unsigned indices means you can just check against too large.
I think a lot of the scenarios where signed is safer are also situations where the application logic would be wrong, so I am a bit skeptical of that argument.
But Ultimately the biggest factor to consider is what your team or prospective team members in your industry are used to, different industries tend to have people who never expect unsigned values vs those who always assume unsigned will be used.