foreach counter now must be size_t ?

Dukc ajieskola at gmail.com
Tue Feb 5 21:51:41 UTC 2019


On Tuesday, 5 February 2019 at 21:16:12 UTC, Rubn wrote:
> 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.

If so, too bad. But it'll still help, because if I try to compile 
to 64-bit, the compiler will catch the error. Without the 
deprecation, there would be a bug (due to 32-bit overflow) that 
likely never manifests, but bites all the harder if it still does.


More information about the Digitalmars-d mailing list