'int' is enough for 'length' to migrate code from x86 to x64
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Fri Nov 21 19:11:22 PST 2014
On Friday, 21 November 2014 at 09:37:50 UTC, Walter Bright wrote:
> 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.
Well yeah, it is kind of ugly looking, and a language construct
for that when we have retro in phobos...
foreach_reverse is essentially dead weight in the spec.
More information about the Digitalmars-d
mailing list