bug in foreach continue

Michael via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 17 04:53:41 PDT 2017


On Friday, 17 March 2017 at 11:30:48 UTC, Jonathan M Davis wrote:
> On Friday, March 17, 2017 01:55:19 Hussien via 
> Digitalmars-d-learn wrote:
>
> I tend to agree with this. If the foreach is static, and 
> continue and break are just going to be ignored, then they 
> should just be illegal. Allowing them is just going to confuse 
> people. Now, making it so that they actually work statically 
> has some interesting possibilities, but that would fall apart 
> as soon as you have any constructs that would use continue or 
> break (e.g. a loop or switch statement) inside the static 
> foreach, and it might break code in rare cases. So, we're 
> probably better off just making them illegal. But having them 
> be legal just seems disingenious, since they don't do anything.
>
> - Jonathan M Davis

What exactly IS happening in the case of a continue in a 
static-if? I could sort of imagine that maybe if you were 
expecting the loop to be unrolled, that you then have a continue 
statement in the correct part of the unrolled loop. But I take it 
this isn't what's happening?


More information about the Digitalmars-d-learn mailing list