September 12, 2007
Downs Wrote:

> > "Downs" wrote
> >> I just came upon the interesting fact that using the "continue" statement in a do { } while() loop does not, in fact, continue with the next loop, but instead continues with the _condition_.

I never knew that (I rarely use do/while); I would have assumed it does another iteration of the loop. I agree that this is unintuitive to me, but others seem to think this is the right behavior and C compatibility is important so it should probably be left as-is.

> miller[] came up with two good alternatives over in #D
> 1) forbidding continue in do/while and replacing it with continue
> do/continue while, or
> 2) adding goto do/goto while statements.
> The first one has the advantage of making it totally impossible for a
> newcomer to trip on this, while the second one has the advantage of not
> breaking existing code.
> Whaddya think?
>  --downs

I like the "goto do"/"goto while" option. It's congruent with "goto case"/"goto default".