On 4/2/2013 8:10 PM, Steven Schveighoffer wrote:
On Tue, 02 Apr 2013 16:32:21 -0400, Walter Bright <newshou...@digitalmars.com>
wrote:
For example, with a signed array index, a bounds check is two comparisons
rather than one.

Why?

struct myArr
{
    int length;
    int opIndex(int idx) { if(cast(uint)idx >= cast(uint)length) throw new
RangeError(); ...}
}

Being able to cast to unsigned implies that the unsigned types exist. So no improvement.

Reply via email to