On Thursday, 20 November 2014 at 15:40:40 UTC, Araq wrote:
Most of the statements I disagreed with were opinions.
"unsigned" means "I want to use modulo 2^^n arithmetic". It
does
not mean, "this is an integer which cannot be negative".
Opinion.
Using modulo 2^^n arithmetic is *weird*.
Opinion.
If you are using
uint/ulong to represent a non-negative integer, you are
using the
incorrect type.
Opinion.
I believe that
bugs caused by unsigned calculations are subtle and require
an
extraordinary level of diligence.
Opinion (correctly qualified as belief).
It's not only his "opinion", it's his *experience* and if we
want
to play the "argument by authority" game: he most likely wrote
more production quality code in D than you did.
Here are some more "opinions":
http://critical.eschertech.com/2010/04/07/danger-unsigned-types-used-here/
My experience is totally the opposite of his. I have been using
unsigned for lengths, widths, heights for the past 15 years in C,
C++, C# and more recently in D with great success. I don't
pretend to be any kind of authority though.
The article you point to is totally flawed and kinda wasteful in
terms of having to read it; the very first code snippet is
obviously buggy. You can't purposefully write buggy code and then
comment on the dangers of this or that!
size_t i;
for (i = size - 1; i >= 0; --i) {
If you that's subtle to you then yes, use signed!