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.

Reply via email to