foreach counter now must be size_t ?
Rubn
where at is.this
Tue Feb 5 21:16:12 UTC 2019
On Tuesday, 5 February 2019 at 11:53:13 UTC, Dukc wrote:
> On Tuesday, 5 February 2019 at 03:15:03 UTC, Timon Gehr wrote:
>>
>> I wish it wasn't. It seems this doesn't do anything useful
>
> It does! Even I, who contribute only occasionally, have more
> than once submitted a PR to Phobos that passes my local 32-bit
> tests, but fails on the GitHub autotester. And the reason is
> precisely because I tend to accidently assign size_t to int or
> uint.
>
> With this change, I can now immediately detect when I make that
> error, and I don't think I'm the only 32-bit user who makes
> them.
Nope this will still work on 32-bit:
foreach(uint i, ref int value; arr )
{
}
size_t is just an alias for uint on 32-bit and ulong on 64-bit.
More information about the Digitalmars-d
mailing list