On 22.01.2012 13:49, Jonathan M Davis wrote:
On Sunday, January 22, 2012 13:40:08 Marco Leise wrote:
I heard that in the past, but in my own experience using unsigned data
types, it did not cause any more bugs. OTOH, textual output is more
correct and I find code easier to understand, if it is using the correct
'class' of integers. But this "a lot of programmers who don't particularly
like using unsigned types" must come from somewhere. Except for existing
bugs in the form of silent under-/overflows that do not appear alarming in
a debugger due to their signedness, I've yet to see a convincing example
of real world code, that I would write this way and is flawed due to the
use of uint instead of int. Or is this like spaces vs. tabs? 'Cause I'm
also a tab user.
Down with tabs! ;)
One issue with unsigned integers right off the bat is for loops.
for(size_t i = a.length; i> 0; --i) {}
is not going to work.
That'll work just fine, you probably meant '>=' ;)