From the D Blog: Driving with D

Max Samukha maxsamukha at gmail.com
Fri Jun 4 21:28:00 UTC 2021


On Friday, 4 June 2021 at 15:48:50 UTC, rikki cattermole wrote:
> Does this form of foreach work?
>
> foreach(i; 0 .. 10)

That does work.

This doesn't:

ubyte[] slice;
foreach (ubyte i; slice) {
}

Invalid bitcast
   %17 = bitcast i16 %15 to i32

I guess the cause is the same - slice.length.sizeof == 4, while 
slice.sizeof == 4, slice.ptr.sizeof == 2, and size_t.sizeof == 2.



More information about the Digitalmars-d-announce mailing list