On Wed, Nov 19, 2014 at 04:08:11PM -0800, Andrei Alexandrescu via Digitalmars-d wrote: > On 11/19/14 12:40 PM, bearophile wrote: > >Andrei Alexandrescu: > > > >>There are related bugs in Java too, e.g. I remember one in binary > >>search where (i + j) / 2 was wrong because of an overflow. > > > >This is possible in D too. > > > > > >>Also, Java does have a package for unsigned integers so apparently > >>it's necessary. > > > >This is irrelevant. No one here is saying that a system language > >should not have unsigned values. The discussion here is about the > >type of array lengths. > > I think we're in good shape with unsigned. -- Andrei
Implicit conversion between signed/unsigned is the fly that spoils the soup, and the source of subtle bugs that persistently crop up when dealing with size_t. The fact of the matter is that humans are error-prone, even when they are aware of the pitfalls of mixing signed / unsigned types, and currently the language is doing nothing to help prevent these sorts of mistakes. T -- Help a man when he is in trouble and he will remember you when he is in trouble again.
