C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Labeled 'continue' and 'break'
From: Andrew Tomazos (andrewtomazos_at_[hidden])
Date: 2020-03-11 02:13:06


I already proposed this in N3879 and presented it to the committee. It was
rejected.

N3879 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3879.pdf>
Explicit
Flow Control: break label, goto case and explicit switch Andrew Tomazos
2014-01-16 2014-01 Evolution rejected

On Wed, Mar 11, 2020 at 10:12 AM Ryan Nicholl via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
> I'd like to suggest adopting labeled break and continue statements,
>
> e.g.
>
> label1: for( int x = 0; x < 5; x++)
> {
> label2: for (int y = 0; y < 5; y++)
> {
> for (int z = 0; z < 5; z++)
> {
> std::cout << x << ',' << y << ',' << z << std::endl;
> if (z+y == 8) continue label2;
> if (z+x == 3) break label2;
> if (x + y + z == 13) break label1;
> }
> }
> }
>
> Other languages have it, and it's convenient with nested loops.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>



STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups