'int' is enough for 'length' to migrate code from x86 to x64

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 21 01:37:50 PST 2014


On 11/21/2014 12:16 AM, Daniel Murphy wrote:
> Over the years most of my unsigned-related bugs have been from screwing up
> various loop conditions.  Thankfully D solves this perfectly with:
>
> void fun(int[] a)
> {
>     foreach_reverse(i, 0...a.length)
>     {
>     }
> }
>
> So I never have to write those again.

I thought everyone hated foreach_reverse!

But, yeah, foreach and ranges+algorithms have virtually eliminated a large 
category of looping bugs.


More information about the Digitalmars-d mailing list