Treating the abusive unsigned syndrome
Ary Borenszweig
ary at esperanto.org.ar
Wed Nov 26 11:04:09 PST 2008
bearophile wrote:
> Andrei Alexandrescu:
>> The problem is, it's much more annoying than one might imagine. Even
>> array.length - 1 is up for scrutiny. Technically, even array.length + 1
>> is a problem because 1 is really a signed int. We could provide
>> exceptions for constants, but exceptions are generally not solving the
>> core issue.
>
> That can be solved making array.length signed.
I agree. I proposed this some time ago. For example, even though C# has
unsigned types, the length of a list, array, etc., is always int. In
this way, they prevented the bugs and problems everyone mention here.
More information about the Digitalmars-d
mailing list