Bring back foreach int indexes

IGotD- nise at nise.com
Thu Nov 30 10:49:47 UTC 2023


On Wednesday, 29 November 2023 at 21:47:09 UTC, bachmeier wrote:
>
> In the case you're talking about, you could do
>
> ```
> foreach(_idx, v; arr) {
>   int idx = cast(int) _idx;
> }
> ```
>
> I don't mind ugly and verbose code if there's sufficient 
> benefit. There's no benefit in this case.

I don't understand why this is not an OK solution instead adding 
yet another lowering for the special case of using int instead of 
size_t. Right now in D indexes are size_t and should be the 
default.

This feels more like a D3 discussion if indexes should be int or 
size_t.



More information about the Digitalmars-d mailing list