foreach counter now must be size_t ?

Rubn where at is.this
Tue Feb 5 23:07:40 UTC 2019


On Tuesday, 5 February 2019 at 23:04:16 UTC, Walter Bright wrote:
> On 2/5/2019 1:14 PM, Rubn wrote:
>> WHAT. WHAT. Where do you see an assignment from size_t to int 
>> here?
>> 
>> int[] arr = someRandomArray();
>> for( int i = 0; i < arr.length; ++i ) {
>>     dg( i, arr[i] );
>> }
>> 
>> ???
>
> The ++i overflows and the loop never terminates.

I'm saying SEMANTICALLY it is correct.


More information about the Digitalmars-d mailing list