Topic: Allow the scope of break to match the scope of continue.


Author: "'John Doggett' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Tue, 31 Jul 2018 00:29:58 -0700 (PDT)
Raw View
------=_Part_11389_2084369394.1533022198966
Content-Type: multipart/alternative;
 boundary="----=_Part_11390_760236159.1533022198966"

------=_Part_11390_760236159.1533022198966
Content-Type: text/plain; charset="UTF-8"

Given that you can use a continue statement from within a switch block, it
is inconsistent that you cannot apply a break statement to the same loop.

I propose that it should be possible to select whether a break statement
associates with a loop or a switch block.


*The problem it solves:*
*When implemented state machines, there have been times when I have had to
write a code kludge, when an elegant solution would have been available if
only the break wasn't swallowed by the switch block which was testing
whether the loop should be exited. *

State machines often simply map on to a loop containing a switch statement.
And it is annoying that while you can continue the loop from within the
switch you cannot break the loop from within the switch.

It is tempting to think that engineers have not particularly missed this
functionality over the decades. But what elegant solutions have not become
common practise due to engineers not having the functionality available?
Being forced to write a kludge in your code makes you reach for other
solutions.

I believe in symmetry, so while I do not feel a strong need to break out of
switch statements when a loop will swallow the break, I think the option
should be supplied.

There are a number of possible solutions:

*My preferred solution:* As this is aimed at C style programming I think it
should look like C rather than C++:

break;        /* still works as it always has. */

break.loop;   /* break out of a loop even if you are in a switch statement.
*/

break.switch; /* break out of a switch, even if you are in a
               * loop within a switch statement.
               */

*Other alternatives considered:*
But there are numerous other possible solutions like:

Pseudo namespaces:
break;
break::loop;
break::switch;
(or the other way around: for::break; while::break; switch::break;)
Glimpsing "::" in a block of code could give the impression that a C++
style solution was being used, when this suggestion slots in
with traditional C.

Or pseudo function calls like break(loop) - looks like loop is a variable -
I prefer other options.
Or new keywords could be added: break_loop, and break_switch - and break
old code - I prefer other options.
Or use a goto - "gotos considered harmful" etc.
Or ...

*How this could be taken further:*
There are those who would like to pass a count to the break command to
specify how many nestled loops to break out of. I'm not sure I'd want to
maintain code written that way. Using a goto may actually be a cleaner way
of achieving the same goal.

Introducing loop type discrimination could offer limited support for a
nestled loop break. So in addition to break.loop, you could have break.for,
and break.while. However more care would be required when refactoring loops.

*Impact on portability*:
If I was given the task of porting code written with break.loop commands to
a computer that only had a K&R C compiler, I would swear rather than enter
depression.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e3a36de8-7b34-43e8-a105-b9b87182200f%40isocpp.org.

------=_Part_11390_760236159.1533022198966
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div style=3D"font-family: arial, sans-serif; font-size: s=
mall;">Given that you can use a=C2=A0<font face=3D"monospace, monospace">co=
ntinue</font>=C2=A0statement from within a switch block, it is inconsistent=
 that you cannot apply a=C2=A0<font face=3D"monospace, monospace">break</fo=
nt>=C2=A0statement to the same loop.<br></div><div style=3D"font-family: ar=
ial, sans-serif; font-size: small;"><div><br class=3D"gmail-m_6310385995705=
27735gmail-Apple-interchange-newline">I propose that it should be possible =
to select whether a=C2=A0<font face=3D"monospace, monospace">break</font>=
=C2=A0statement associates with a loop or a switch block.</div><br class=3D=
"gmail-m_631038599570527735gmail-Apple-interchange-newline"><br></div><div =
style=3D"font-family: arial, sans-serif; font-size: small;"><b>The problem =
it solves:</b></div><div style=3D"font-family: arial, sans-serif; font-size=
: small;"><b><span style=3D"font-weight: 400;">When implemented state machi=
nes, t</span><span style=3D"font-weight: 400;">here have been times when I =
have had to write a code kludge, when an elegant solution would have been a=
vailable if only the break wasn&#39;t swallowed by the switch block which w=
as testing whether the loop should be exited.</span>=C2=A0</b>=C2=A0<br></d=
iv><div style=3D"font-family: arial, sans-serif; font-size: small;"><div><b=
r></div><div>State machines often simply map on to a loop containing a swit=
ch statement. And it is annoying that while you can=C2=A0<font face=3D"mono=
space, monospace">continue</font>=C2=A0the loop=C2=A0from=C2=A0within the s=
witch you cannot=C2=A0<span style=3D"font-family: monospace, monospace;">br=
eak</span>=C2=A0the loop from within the switch.<br></div><div><br></div><d=
iv>It is tempting to think that engineers have not particularly missed this=
 functionality over the decades. But what elegant solutions have not become=
 common practise due to engineers not having the functionality available? B=
eing forced to write a kludge in your code makes you reach for other soluti=
ons.</div><div><br></div><div>I believe in symmetry, so while I do not feel=
 a strong need to break out of switch statements when a loop will swallow t=
he break, I think the option should be supplied.</div><div><br><div>There a=
re a number of possible solutions:</div><div><br></div><div><b>My preferred=
 solution:</b>=C2=A0As this is aimed at C style programming I think it shou=
ld look like C rather than C++:</div><div><br></div><div style=3D"font-size=
: 12.8px;"><div style=3D"font-size: small;"><font face=3D"monospace, monosp=
ace">break;=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* still works as it always has. */<=
/font></div><div style=3D"font-size: small;"><font face=3D"monospace, monos=
pace"><br></font></div><div style=3D"font-size: small;"><span style=3D"font=
-family: monospace, monospace;">break.loop;=C2=A0 =C2=A0/* break out of a l=
oop even if you are in a switch statement. */</span><br></div><div style=3D=
"font-size: small;"><font face=3D"monospace, monospace"><br></font></div><d=
iv style=3D"font-size: small;"><font face=3D"monospace, monospace">break.sw=
itch; /* break out of a switch,=C2=A0</font><span style=3D"font-family: mon=
ospace, monospace;">even if you are in a</span></div><div style=3D"font-siz=
e: small;"><span style=3D"font-family: monospace, monospace;">=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* loop within a switch statement.=
</span></div><div style=3D"font-size: small;"><span style=3D"font-family: m=
onospace, monospace;">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0*/</span><span style=3D"font-family: monospace, monospace;"><br></span><=
/div><div style=3D"font-size: small;"><br></div><div><b>Other alternatives =
considered:</b><br></div>But there are numerous other possible solutions li=
ke:<br></div><div><br></div><div>Pseudo namespaces:</div><div><font face=3D=
"monospace, monospace">break;</font></div><div><font face=3D"monospace, mon=
ospace">break::loop;</font></div><div><font face=3D"monospace, monospace">b=
reak::switch;</font></div><div><font face=3D"monospace, monospace">(or the =
other way around:=C2=A0</font><span style=3D"font-family: monospace, monosp=
ace;">for::break;=C2=A0</span><span style=3D"font-family: monospace, monosp=
ace;">while::<wbr>break;=C2=A0</span><span style=3D"font-family: monospace,=
 monospace;">switch::break;)</span></div><div>Glimpsing &quot;::&quot; in a=
 block of code could give the impression that a C++ style solution was bein=
g used, when this suggestion slots in with=C2=A0traditional C.</div><div><b=
r></div><div>Or pseudo function calls like break(loop) - looks like loop is=
 a variable - I prefer other options.</div><div>Or new keywords could be ad=
ded: break_loop, and break_switch - and break old code - I prefer other opt=
ions.</div><div><div>Or use a goto - &quot;gotos considered harmful&quot; e=
tc.</div><div>Or ...<br></div><div><br></div><b>How this could be taken fur=
ther:</b></div><div>There are those who would like to pass a count to the b=
reak command to specify how many nestled loops to break out of. I&#39;m not=
 sure I&#39;d want to maintain code written that way. Using a goto may actu=
ally be a cleaner way of achieving the same goal.</div><div><br></div><div>=
Introducing loop type discrimination could offer limited support for a nest=
led loop break. So in addition to=C2=A0<font face=3D"monospace, monospace">=
break.loop</font>, you could have=C2=A0<font face=3D"monospace, monospace">=
break.for</font>, and=C2=A0<font face=3D"monospace, monospace">break.while<=
/font>. However more care would be required when refactoring loops.</div><d=
iv><br></div><div><b>Impact on portability</b>:</div><div>If I was given th=
e task of porting code written with=C2=A0<font face=3D"monospace, monospace=
">break.loop</font>=C2=A0commands to a computer that only had a K&amp;R C c=
ompiler, I would swear rather than enter depression.</div><div class=3D"gma=
il-yj6qo" style=3D"font-size: 12.8px;"></div><br class=3D"gmail-Apple-inter=
change-newline"></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e3a36de8-7b34-43e8-a105-b9b87182200f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e3a36de8-7b34-43e8-a105-b9b87182200f=
%40isocpp.org</a>.<br />

------=_Part_11390_760236159.1533022198966--

------=_Part_11389_2084369394.1533022198966--

.


Author: florian.csdt@gmail.com
Date: Tue, 31 Jul 2018 01:55:34 -0700 (PDT)
Raw View
------=_Part_11451_1180681641.1533027334540
Content-Type: multipart/alternative;
 boundary="----=_Part_11452_109573330.1533027334541"

------=_Part_11452_109573330.1533027334541
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



Le mardi 31 juillet 2018 09:29:59 UTC+2, John Doggett a =C3=A9crit :
>
> Given that you can use a continue statement from within a switch block,=
=20
> it is inconsistent that you cannot apply a break statement to the same=20
> loop.
>
> I propose that it should be possible to select whether a break statement=
=20
> associates with a loop or a switch block.
>
>
> *The problem it solves:*
> *When implemented state machines, there have been times when I have had t=
o=20
> write a code kludge, when an elegant solution would have been available i=
f=20
> only the break wasn't swallowed by the switch block which was testing=20
> whether the loop should be exited. *=20
>
> State machines often simply map on to a loop containing a switch=20
> statement. And it is annoying that while you can continue the=20
> loop from within the switch you cannot break the loop from within the=20
> switch.
>
> It is tempting to think that engineers have not particularly missed this=
=20
> functionality over the decades. But what elegant solutions have not becom=
e=20
> common practise due to engineers not having the functionality available?=
=20
> Being forced to write a kludge in your code makes you reach for other=20
> solutions.
>
> I believe in symmetry, so while I do not feel a strong need to break out=
=20
> of switch statements when a loop will swallow the break, I think the opti=
on=20
> should be supplied.
>
> There are a number of possible solutions:
>
> *My preferred solution:* As this is aimed at C style programming I think=
=20
> it should look like C rather than C++:
>
> break;        /* still works as it always has. */
>
> break.loop;   /* break out of a loop even if you are in a switch=20
> statement. */
>
> break.switch; /* break out of a switch, even if you are in a
>                * loop within a switch statement.
>                */
>
> *Other alternatives considered:*
> But there are numerous other possible solutions like:
>
> Pseudo namespaces:
> break;
> break::loop;
> break::switch;
> (or the other way around: for::break; while::break; switch::break;)
> Glimpsing "::" in a block of code could give the impression that a C++=20
> style solution was being used, when this suggestion slots in=20
> with traditional C.
>
> Or pseudo function calls like break(loop) - looks like loop is a variable=
=20
> - I prefer other options.
> Or new keywords could be added: break_loop, and break_switch - and break=
=20
> old code - I prefer other options.
> Or use a goto - "gotos considered harmful" etc.
> Or ...
>
> *How this could be taken further:*
> There are those who would like to pass a count to the break command to=20
> specify how many nestled loops to break out of. I'm not sure I'd want to=
=20
> maintain code written that way. Using a goto may actually be a cleaner wa=
y=20
> of achieving the same goal.
>
> Introducing loop type discrimination could offer limited support for a=20
> nestled loop break. So in addition to break.loop, you could have break.fo=
r,=20
> and break.while. However more care would be required when refactoring=20
> loops.
>
> *Impact on portability*:
> If I was given the task of porting code written with break.loop commands=
=20
> to a computer that only had a K&R C compiler, I would swear rather than=
=20
> enter depression.
>
>
I give you an alternative:
for_label: for (...) {
  switch_label: switch (...) {
    case ...:
      for (...) {
        if (...) break; // breaks the innermost loop
        if (...) break(switch_label); // breaks the switch
        if (...) break(for_label); // breaks the outermost loop
      }
  }
}

Like, you can safely specify which structure you want to break.
Of course, you can also imagine that for continue

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/8d2cbc8d-f5d1-4cb1-9cdb-d2b50b0794ca%40isocpp.or=
g.

------=_Part_11452_109573330.1533027334541
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>Le mardi 31 juillet 2018 09:29:59 UTC+2, John Dogg=
ett a =C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr"><div style=3D"font-family:arial,sans-serif;font-size:small">Given=
 that you can use a=C2=A0<font face=3D"monospace, monospace">continue</font=
>=C2=A0statement from within a switch block, it is inconsistent that you ca=
nnot apply a=C2=A0<font face=3D"monospace, monospace">break</font>=C2=A0sta=
tement to the same loop.<br></div><div style=3D"font-family:arial,sans-seri=
f;font-size:small"><div><br>I propose that it should be possible to select =
whether a=C2=A0<font face=3D"monospace, monospace">break</font>=C2=A0statem=
ent associates with a loop or a switch block.</div><br><br></div><div style=
=3D"font-family:arial,sans-serif;font-size:small"><b>The problem it solves:=
</b></div><div style=3D"font-family:arial,sans-serif;font-size:small"><b><s=
pan style=3D"font-weight:400">When implemented state machines, t</span><spa=
n style=3D"font-weight:400">here have been times when I have had to write a=
 code kludge, when an elegant solution would have been available if only th=
e break wasn&#39;t swallowed by the switch block which was testing whether =
the loop should be exited.</span>=C2=A0</b>=C2=A0<br></div><div style=3D"fo=
nt-family:arial,sans-serif;font-size:small"><div><br></div><div>State machi=
nes often simply map on to a loop containing a switch statement. And it is =
annoying that while you can=C2=A0<font face=3D"monospace, monospace">contin=
ue</font>=C2=A0the loop=C2=A0from=C2=A0within the switch you cannot=C2=A0<s=
pan style=3D"font-family:monospace,monospace">break</span>=C2=A0the loop fr=
om within the switch.<br></div><div><br></div><div>It is tempting to think =
that engineers have not particularly missed this functionality over the dec=
ades. But what elegant solutions have not become common practise due to eng=
ineers not having the functionality available? Being forced to write a klud=
ge in your code makes you reach for other solutions.</div><div><br></div><d=
iv>I believe in symmetry, so while I do not feel a strong need to break out=
 of switch statements when a loop will swallow the break, I think the optio=
n should be supplied.</div><div><br><div>There are a number of possible sol=
utions:</div><div><br></div><div><b>My preferred solution:</b>=C2=A0As this=
 is aimed at C style programming I think it should look like C rather than =
C++:</div><div><br></div><div style=3D"font-size:12.8px"><div style=3D"font=
-size:small"><font face=3D"monospace, monospace">break;=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 /* still works as it always has. */</font></div><div style=3D"font-=
size:small"><font face=3D"monospace, monospace"><br></font></div><div style=
=3D"font-size:small"><span style=3D"font-family:monospace,monospace">break.=
loop;=C2=A0 =C2=A0/* break out of a loop even if you are in a switch statem=
ent. */</span><br></div><div style=3D"font-size:small"><font face=3D"monosp=
ace, monospace"><br></font></div><div style=3D"font-size:small"><font face=
=3D"monospace, monospace">break.switch; /* break out of a switch,=C2=A0</fo=
nt><span style=3D"font-family:monospace,monospace">even if you are in a</sp=
an></div><div style=3D"font-size:small"><span style=3D"font-family:monospac=
e,monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* loop =
within a switch statement.</span></div><div style=3D"font-size:small"><span=
 style=3D"font-family:monospace,monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0*/</span><span style=3D"font-family:monospace,monos=
pace"><br></span></div><div style=3D"font-size:small"><br></div><div><b>Oth=
er alternatives considered:</b><br></div>But there are numerous other possi=
ble solutions like:<br></div><div><br></div><div>Pseudo namespaces:</div><d=
iv><font face=3D"monospace, monospace">break;</font></div><div><font face=
=3D"monospace, monospace">break::loop;</font></div><div><font face=3D"monos=
pace, monospace">break::switch;</font></div><div><font face=3D"monospace, m=
onospace">(or the other way around:=C2=A0</font><span style=3D"font-family:=
monospace,monospace">for::break;=C2=A0</span><span style=3D"font-family:mon=
ospace,monospace">while::<wbr>break;=C2=A0</span><span style=3D"font-family=
:monospace,monospace">switch::break;)</span></div><div>Glimpsing &quot;::&q=
uot; in a block of code could give the impression that a C++ style solution=
 was being used, when this suggestion slots in with=C2=A0traditional C.</di=
v><div><br></div><div>Or pseudo function calls like break(loop) - looks lik=
e loop is a variable - I prefer other options.</div><div>Or new keywords co=
uld be added: break_loop, and break_switch - and break old code - I prefer =
other options.</div><div><div>Or use a goto - &quot;gotos considered harmfu=
l&quot; etc.</div><div>Or ...<br></div><div><br></div><b>How this could be =
taken further:</b></div><div>There are those who would like to pass a count=
 to the break command to specify how many nestled loops to break out of. I&=
#39;m not sure I&#39;d want to maintain code written that way. Using a goto=
 may actually be a cleaner way of achieving the same goal.</div><div><br></=
div><div>Introducing loop type discrimination could offer limited support f=
or a nestled loop break. So in addition to=C2=A0<font face=3D"monospace, mo=
nospace">break.loop</font>, you could have=C2=A0<font face=3D"monospace, mo=
nospace">break.for</font>, and=C2=A0<font face=3D"monospace, monospace">bre=
ak.while</font>. However more care would be required when refactoring loops=
..</div><div><br></div><div><b>Impact on portability</b>:</div><div>If I was=
 given the task of porting code written with=C2=A0<font face=3D"monospace, =
monospace">break.loop</font>=C2=A0commands to a computer that only had a K&=
amp;R C compiler, I would swear rather than enter depression.</div><div sty=
le=3D"font-size:12.8px"></div><br></div></div></div></blockquote><div><br><=
/div><div>I give you an alternative:</div><div><div style=3D"background-col=
or: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: sol=
id; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><c=
ode class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">for_label</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">for</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(...)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 switch_l=
abel</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">switch</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(...)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">case</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">...:</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">for</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(...)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>if</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">(...)</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">break</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// breaks the innermost loop</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">if</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(...)</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">break</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">switch_label</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">// breaks the switch</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">if</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(...)</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">break</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">for_label=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">// breaks the outermost loo=
p</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code>=
</div><br> Like, you can safely specify which structure you want to break.<=
/div><div>Of course, you can also imagine that for continue<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8d2cbc8d-f5d1-4cb1-9cdb-d2b50b0794ca%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8d2cbc8d-f5d1-4cb1-9cdb-d2b50b0794ca=
%40isocpp.org</a>.<br />

------=_Part_11452_109573330.1533027334541--

------=_Part_11451_1180681641.1533027334540--

.


Author: Vinnie Falco <vinnie.falco@gmail.com>
Date: Tue, 31 Jul 2018 15:18:27 -0700 (PDT)
Raw View
------=_Part_11716_736770847.1533075507475
Content-Type: multipart/alternative;
 boundary="----=_Part_11717_1346761282.1533075507475"

------=_Part_11717_1346761282.1533075507475
Content-Type: text/plain; charset="UTF-8"

On Tuesday, July 31, 2018 at 12:29:59 AM UTC-7, John Doggett wrote:
>
> I propose that it should be possible to select whether a break statement
> associates with a loop or a switch block.
>

Surprisingly, I have found that `goto` is incredibly appropriate for my
particular use-case in writing composed asynchronous operations. Example
(search for `goto`):

<https://github.com/boostorg/beast/blob/1da229a27c6f0539d422bcedbcf47cfe2517164a/include/boost/beast/websocket/impl/read.ipp#L188>

Until recently I have avoided the use of `goto` ("the boogeyman") but two
things changed my mind. 1, their utility in this particular use-case, and
2. the realization that `break` and `continue` are just aliases for `goto`.

Despite my heavy use of `goto` now, I have not felt it necessary in any way
for C++ to evolve to make this use-case different syntactically (i.e.
break-to-switch or break-to-for). I don't think that the amount of benefit
is sufficient relative to the cost of adding such a feature.

Thanks

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/9fbcf6b2-4cab-401f-8095-38c878827dcd%40isocpp.org.

------=_Part_11717_1346761282.1533075507475
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, July 31, 2018 at 12:29:59 AM UTC-7, John Dogge=
tt wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: =
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div=
 style=3D"font-family:arial,sans-serif;font-size:small">I propose that it s=
hould be possible to select whether a=C2=A0<font face=3D"monospace, monospa=
ce">break</font>=C2=A0statement associates with a loop or a switch block.</=
div></div></blockquote><div><br></div><div>Surprisingly, I have found that =
`goto` is incredibly appropriate for my particular use-case in writing comp=
osed asynchronous operations. Example (search for `goto`):<br><br>&lt;https=
://github.com/boostorg/beast/blob/1da229a27c6f0539d422bcedbcf47cfe2517164a/=
include/boost/beast/websocket/impl/read.ipp#L188&gt;<br><br></div><div>Unti=
l recently I have avoided the use of `goto` (&quot;the boogeyman&quot;) but=
 two things changed my mind. 1, their utility in this particular use-case, =
and 2. the realization that `break` and `continue` are just aliases for `go=
to`.<br><br>Despite my heavy use of `goto` now, I have not felt it necessar=
y in any way for C++ to evolve to make this use-case different syntacticall=
y (i.e. break-to-switch or break-to-for). I don&#39;t think that the amount=
 of benefit is sufficient relative to the cost of adding such a feature.</d=
iv><div><br>Thanks<br></div><div><br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/9fbcf6b2-4cab-401f-8095-38c878827dcd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9fbcf6b2-4cab-401f-8095-38c878827dcd=
%40isocpp.org</a>.<br />

------=_Part_11717_1346761282.1533075507475--

------=_Part_11716_736770847.1533075507475--

.


Author: "'John Doggett' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Wed, 1 Aug 2018 00:01:29 -0700 (PDT)
Raw View
------=_Part_3843_702310670.1533106889735
Content-Type: multipart/alternative;
 boundary="----=_Part_3844_2028100413.1533106889736"

------=_Part_3844_2028100413.1533106889736
Content-Type: text/plain; charset="UTF-8"

An alternate title for my proposal could have been "Allow the switch statement
to break out of loops just like the if statement can"

The use of labels opens up tempting capabilities, but there is a danger of
ending up with something that no longer looks like C.

My proposal is to make the smallest possible change to fix the fact that in
C one keyword "break" has been forced to do two incompatible jobs, when
those jobs should have been split between two separate keywords from the
start. (True this is not a problem in a language with labelled loops, but C
isn't that language.)

I feel that if the change is small enough, unobtrusive enough, and elegant
enough, then there is just a chance that ISO will accept it. And maybe it
will be absorbed back into a future C standard.

Making changes to the core of the language like this is a big ask. And
Bjarne Stroustrup has said "Many/most people in WG21 are working
independently towards non-shared goals. Individually, many (most?)
proposals make sense. Together they are insanity to the point of
endangering the future of C++.":
http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0977r0.pdf

Maybe hold out until C++23 before suggesting break.loop(label)?


On Tuesday, July 31, 2018 at 8:29:59 AM UTC+1, John Doggett wrote:
>
> Given that you can use a continue statement from within a switch block,
> it is inconsistent that you cannot apply a break statement to the same
> loop.
>
> I propose that it should be possible to select whether a break statement
> associates with a loop or a switch block.
>
>
> *The problem it solves:*
> *When implemented state machines, there have been times when I have had to
> write a code kludge, when an elegant solution would have been available if
> only the break wasn't swallowed by the switch block which was testing
> whether the loop should be exited. *
>
> State machines often simply map on to a loop containing a switch
> statement. And it is annoying that while you can continue the
> loop from within the switch you cannot break the loop from within the
> switch.
>
> It is tempting to think that engineers have not particularly missed this
> functionality over the decades. But what elegant solutions have not become
> common practise due to engineers not having the functionality available?
> Being forced to write a kludge in your code makes you reach for other
> solutions.
>
> I believe in symmetry, so while I do not feel a strong need to break out
> of switch statements when a loop will swallow the break, I think the option
> should be supplied.
>
> There are a number of possible solutions:
>
> *My preferred solution:* As this is aimed at C style programming I think
> it should look like C rather than C++:
>
> break;        /* still works as it always has. */
>
> break.loop;   /* break out of a loop even if you are in a switch
> statement. */
>
> break.switch; /* break out of a switch, even if you are in a
>                * loop within a switch statement.
>                */
>
> *Other alternatives considered:*
> But there are numerous other possible solutions like:
>
> Pseudo namespaces:
> break;
> break::loop;
> break::switch;
> (or the other way around: for::break; while::break; switch::break;)
> Glimpsing "::" in a block of code could give the impression that a C++
> style solution was being used, when this suggestion slots in
> with traditional C.
>
> Or pseudo function calls like break(loop) - looks like loop is a variable
> - I prefer other options.
> Or new keywords could be added: break_loop, and break_switch - and break
> old code - I prefer other options.
> Or use a goto - "gotos considered harmful" etc.
> Or ...
>
> *How this could be taken further:*
> There are those who would like to pass a count to the break command to
> specify how many nestled loops to break out of. I'm not sure I'd want to
> maintain code written that way. Using a goto may actually be a cleaner way
> of achieving the same goal.
>
> Introducing loop type discrimination could offer limited support for a
> nestled loop break. So in addition to break.loop, you could have break.for,
> and break.while. However more care would be required when refactoring
> loops.
>
> *Impact on portability*:
> If I was given the task of porting code written with break.loop commands
> to a computer that only had a K&R C compiler, I would swear rather than
> enter depression.
>
>

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/b2c22570-5d17-4553-8ca1-4f57da9fe3a9%40isocpp.org.

------=_Part_3844_2028100413.1533106889736
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div style=3D"font-family: arial, sans-serif; font-size: s=
mall;">An alternate title for my proposal could have been &quot;Allow the=
=C2=A0<font face=3D"monospace, monospace">switch</font>=C2=A0statement to b=
reak out of loops just like the=C2=A0<font face=3D"monospace, monospace">if=
</font>=C2=A0statement can&quot;</div><div style=3D"font-family: arial, san=
s-serif; font-size: small;"><br></div><div style=3D"font-family: arial, san=
s-serif; font-size: small;">The use of labels opens up tempting capabilitie=
s, but there is a danger of ending up with something that no longer looks l=
ike C.</div><div style=3D"font-family: arial, sans-serif; font-size: small;=
"><br></div><div style=3D"font-family: arial, sans-serif; font-size: small;=
">My proposal is to make the smallest possible change to fix the fact that =
in C one keyword &quot;break&quot; has been forced to do two incompatible j=
obs, when those jobs should have been split between two separate keywords f=
rom the start. (True this is not a problem in a language with labelled loop=
s, but C isn&#39;t that language.)<br></div><div style=3D"font-family: aria=
l, sans-serif; font-size: small;"><br></div><div style=3D"font-family: aria=
l, sans-serif; font-size: small;">I feel that if the change is small enough=
, unobtrusive enough, and elegant enough, then there is just a chance that =
ISO will accept it. And maybe it will be absorbed back into a future C stan=
dard.=C2=A0</div><div style=3D"font-family: arial, sans-serif; font-size: s=
mall;"><br></div><div style=3D"font-family: arial, sans-serif; font-size: s=
mall;">Making changes to the core of the language like this is a big ask. A=
nd Bjarne Stroustrup has said &quot;Many/most people in WG21 are working in=
dependently towards non-shared goals. Individually, many (most?) proposals =
make sense. Together they are insanity to the point of endangering the futu=
re of C++.&quot;:=C2=A0<a href=3D"http://open-std.org/JTC1/SC22/WG21/docs/p=
apers/2018/p0977r0.pdf" style=3D"color: rgb(17, 85, 204);">http://open-std.=
org/JTC1/SC22/WG21/docs/papers/2018/p0977r0.pdf</a></div><div style=3D"font=
-family: arial, sans-serif; font-size: small;"><br></div><div style=3D"font=
-family: arial, sans-serif; font-size: small;">Maybe hold out until C++23 b=
efore suggesting break.loop(label)?</div><div><br></div><br>On Tuesday, Jul=
y 31, 2018 at 8:29:59 AM UTC+1, John Doggett wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid=
;padding-left: 1ex;"><div dir=3D"ltr"><div style=3D"font-family:arial,sans-=
serif;font-size:small">Given that you can use a=C2=A0<font face=3D"monospac=
e, monospace">continue</font>=C2=A0statement from within a switch block, it=
 is inconsistent that you cannot apply a=C2=A0<font face=3D"monospace, mono=
space">break</font>=C2=A0statement to the same loop.<br></div><div style=3D=
"font-family:arial,sans-serif;font-size:small"><div><br>I propose that it s=
hould be possible to select whether a=C2=A0<font face=3D"monospace, monospa=
ce">break</font>=C2=A0statement associates with a loop or a switch block.</=
div><br><br></div><div style=3D"font-family:arial,sans-serif;font-size:smal=
l"><b>The problem it solves:</b></div><div style=3D"font-family:arial,sans-=
serif;font-size:small"><b><span style=3D"font-weight:400">When implemented =
state machines, t</span><span style=3D"font-weight:400">here have been time=
s when I have had to write a code kludge, when an elegant solution would ha=
ve been available if only the break wasn&#39;t swallowed by the switch bloc=
k which was testing whether the loop should be exited.</span>=C2=A0</b>=C2=
=A0<br></div><div style=3D"font-family:arial,sans-serif;font-size:small"><d=
iv><br></div><div>State machines often simply map on to a loop containing a=
 switch statement. And it is annoying that while you can=C2=A0<font face=3D=
"monospace, monospace">continue</font>=C2=A0the loop=C2=A0from=C2=A0within =
the switch you cannot=C2=A0<span style=3D"font-family:monospace,monospace">=
break</span>=C2=A0the loop from within the switch.<br></div><div><br></div>=
<div>It is tempting to think that engineers have not particularly missed th=
is functionality over the decades. But what elegant solutions have not beco=
me common practise due to engineers not having the functionality available?=
 Being forced to write a kludge in your code makes you reach for other solu=
tions.</div><div><br></div><div>I believe in symmetry, so while I do not fe=
el a strong need to break out of switch statements when a loop will swallow=
 the break, I think the option should be supplied.</div><div><br><div>There=
 are a number of possible solutions:</div><div><br></div><div><b>My preferr=
ed solution:</b>=C2=A0As this is aimed at C style programming I think it sh=
ould look like C rather than C++:</div><div><br></div><div style=3D"font-si=
ze:12.8px"><div style=3D"font-size:small"><font face=3D"monospace, monospac=
e">break;=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* still works as it always has. */</f=
ont></div><div style=3D"font-size:small"><font face=3D"monospace, monospace=
"><br></font></div><div style=3D"font-size:small"><span style=3D"font-famil=
y:monospace,monospace">break.loop;=C2=A0 =C2=A0/* break out of a loop even =
if you are in a switch statement. */</span><br></div><div style=3D"font-siz=
e:small"><font face=3D"monospace, monospace"><br></font></div><div style=3D=
"font-size:small"><font face=3D"monospace, monospace">break.switch; /* brea=
k out of a switch,=C2=A0</font><span style=3D"font-family:monospace,monospa=
ce">even if you are in a</span></div><div style=3D"font-size:small"><span s=
tyle=3D"font-family:monospace,monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0* loop within a switch statement.</span></div><div sty=
le=3D"font-size:small"><span style=3D"font-family:monospace,monospace">=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/</span><span style=3D=
"font-family:monospace,monospace"><br></span></div><div style=3D"font-size:=
small"><br></div><div><b>Other alternatives considered:</b><br></div>But th=
ere are numerous other possible solutions like:<br></div><div><br></div><di=
v>Pseudo namespaces:</div><div><font face=3D"monospace, monospace">break;</=
font></div><div><font face=3D"monospace, monospace">break::loop;</font></di=
v><div><font face=3D"monospace, monospace">break::switch;</font></div><div>=
<font face=3D"monospace, monospace">(or the other way around:=C2=A0</font><=
span style=3D"font-family:monospace,monospace">for::break;=C2=A0</span><spa=
n style=3D"font-family:monospace,monospace">while::<wbr>break;=C2=A0</span>=
<span style=3D"font-family:monospace,monospace">switch::break;)</span></div=
><div>Glimpsing &quot;::&quot; in a block of code could give the impression=
 that a C++ style solution was being used, when this suggestion slots in wi=
th=C2=A0traditional C.</div><div><br></div><div>Or pseudo function calls li=
ke break(loop) - looks like loop is a variable - I prefer other options.</d=
iv><div>Or new keywords could be added: break_loop, and break_switch - and =
break old code - I prefer other options.</div><div><div>Or use a goto - &qu=
ot;gotos considered harmful&quot; etc.</div><div>Or ...<br></div><div><br><=
/div><b>How this could be taken further:</b></div><div>There are those who =
would like to pass a count to the break command to specify how many nestled=
 loops to break out of. I&#39;m not sure I&#39;d want to maintain code writ=
ten that way. Using a goto may actually be a cleaner way of achieving the s=
ame goal.</div><div><br></div><div>Introducing loop type discrimination cou=
ld offer limited support for a nestled loop break. So in addition to=C2=A0<=
font face=3D"monospace, monospace">break.loop</font>, you could have=C2=A0<=
font face=3D"monospace, monospace">break.for</font>, and=C2=A0<font face=3D=
"monospace, monospace">break.while</font>. However more care would be requi=
red when refactoring loops.</div><div><br></div><div><b>Impact on portabili=
ty</b>:</div><div>If I was given the task of porting code written with=C2=
=A0<font face=3D"monospace, monospace">break.loop</font>=C2=A0commands to a=
 computer that only had a K&amp;R C compiler, I would swear rather than ent=
er depression.</div><div style=3D"font-size:12.8px"></div><br></div></div><=
/div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b2c22570-5d17-4553-8ca1-4f57da9fe3a9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b2c22570-5d17-4553-8ca1-4f57da9fe3a9=
%40isocpp.org</a>.<br />

------=_Part_3844_2028100413.1533106889736--

------=_Part_3843_702310670.1533106889735--

.


Author: Barry Revzin <barry.revzin@gmail.com>
Date: Wed, 1 Aug 2018 09:56:46 -0700 (PDT)
Raw View
------=_Part_32_884390377.1533142606966
Content-Type: multipart/alternative;
 boundary="----=_Part_33_852803625.1533142606966"

------=_Part_33_852803625.1533142606966
Content-Type: text/plain; charset="UTF-8"



On Tuesday, July 31, 2018 at 3:55:34 AM UTC-5, floria...@gmail.com wrote:
>
> I give you an alternative:
> for_label: for (...) {
>   switch_label: switch (...) {
>     case ...:
>       for (...) {
>         if (...) break; // breaks the innermost loop
>         if (...) break(switch_label); // breaks the switch
>         if (...) break(for_label); // breaks the outermost loop
>       }
>   }
> }
>
> Like, you can safely specify which structure you want to break.
> Of course, you can also imagine that for continue
>


This was N3879
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3879.pdf).
There's a separate thing called "explicit switch" in this paper, but just
the "break label;" and "continue label;" was polled specifically by EWG in
Rapperswil 2014 and there was no consensus: SF 3 - WF 8 - N 4 - WA 9 - SA 3.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/76377dd7-7eee-4017-ad0b-5cb11e10eecd%40isocpp.org.

------=_Part_33_852803625.1533142606966
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, July 31, 2018 at 3:55:34 AM UTC-5, flo=
ria...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr"><div>I give you an alternative:</div><div><div style=3D"backgroun=
d-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;b=
order-width:1px"><code><div><span style=3D"color:#000">for_label</span><spa=
n style=3D"color:#660">:</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">for</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">(...)</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 switch_label<=
/span><span style=3D"color:#660">:</span><span style=3D"color:#000"> </span=
><span style=3D"color:#008">switch</span><span style=3D"color:#000"> </span=
><span style=3D"color:#660">(...)</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#008">case</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#660">...:</span><span style=3D"color:#000=
"><br>=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">for</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#660">(...)</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#660">{</span><span styl=
e=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"colo=
r:#008">if</span><span style=3D"color:#000"> </span><span style=3D"color:#6=
60">(...)</span><span style=3D"color:#000"> </span><span style=3D"color:#00=
8">break</span><span style=3D"color:#660">;</span><span style=3D"color:#000=
"> </span><span style=3D"color:#800">// breaks the innermost loop</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:#008">if</span><span style=3D"color:#000"> </span><span style=3D"=
color:#660">(...)</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">break</span><span style=3D"color:#660">(</span><span style=3D"co=
lor:#000">switch_label</span><span style=3D"color:#660">);</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#800">// breaks the switch</s=
pan><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span=
 style=3D"color:#008">if</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#660">(...)</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#008">break</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">for_label</span><span style=3D"color:#660">);</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#800">// breaks the outerm=
ost loop</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 </span><=
span style=3D"color:#660">}</span><span style=3D"color:#000"><br>=C2=A0 </s=
pan><span style=3D"color:#660">}</span><span style=3D"color:#000"><br></spa=
n><span style=3D"color:#660">}</span><span style=3D"color:#000"><br></span>=
</div></code></div><br> Like, you can safely specify which structure you wa=
nt to break.</div><div>Of course, you can also imagine that for continue<br=
></div></div></blockquote><div><br></div><div><br></div><div>This was N3879=
 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3879.pdf). There=
&#39;s a separate thing called &quot;explicit switch&quot; in this paper, b=
ut just the &quot;break label;&quot; and &quot;continue label;&quot; was po=
lled specifically by EWG in Rapperswil 2014 and there was no consensus:=C2=
=A0SF 3 - WF 8 - N 4 - WA 9 - SA 3.</div><div><br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/76377dd7-7eee-4017-ad0b-5cb11e10eecd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/76377dd7-7eee-4017-ad0b-5cb11e10eecd=
%40isocpp.org</a>.<br />

------=_Part_33_852803625.1533142606966--

------=_Part_32_884390377.1533142606966--

.