On Thursday, 29 June 2017 at 19:12:24 UTC, ag0aep6g wrote:
On Thursday, 29 June 2017 at 18:03:39 UTC, Ecstatic Coder wrote:
I often do code like "x < array.length" where x needs to be a long to be able to handle negative values.

I want my code to compile without warning, and therefore I'm against requiring "x < array.length.to!long()" to remove that warning.

`x < array.length` and `x < array.length.to!long` have different results when x is negative. That's why a warning/error is in order.

I often have array indices that go up and down (x++/x--) depending on the logic.

I find convenient to be able to test them (x >= 0, x < a.length) without having to manage the fact that the array stores its length as an unsigned integer to double its potential size, since anyway I never use arrays with 2^63 items.

Reply via email to