Foreach loops on static arrays error message

Andrea Fontana via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 6 02:00:47 PDT 2017


On Thursday, 6 July 2017 at 08:26:42 UTC, Guillaume Chatelet 
wrote:
> From the programmer's point of view the original code makes 
> sense.
> A correct lowering would be:
>
>> ubyte[256] data;
>> for(ubyte i = 0;;++i) {
>>    ubyte x = data[i];
>>    ...
>>    if(i==255) break;
>> }

or:

ubyte[256] data;
foreach(ubyte i; 0..256) {
   ubyte x = data[i];
}
	



More information about the Digitalmars-d mailing list