access foreach index counter for Iterate n times

mw mingwu at gmail.com
Sat May 21 15:43:59 UTC 2022


On Saturday, 21 May 2022 at 15:23:08 UTC, Adam D Ruppe wrote:
> On Saturday, 21 May 2022 at 15:06:31 UTC, mw wrote:
>>> It isn't a loop counter. It is an index back into the 
>>> original source. Consider:
>>
>> 1) First, why not 0 then 4? Since dchar is 32 bits.
>
> It is an index back into the *original source* given to foreach.
>
> I gave it a char[], not a dchar[]. So it is counting chars in 
> that original char[].
>

Same question:


Why 3 bytes? Not 4 bytes?

As dchar is specified as 32 bits here?

https://dlang.org/spec/type.html






More information about the Digitalmars-d mailing list