Topic: Allow the scope of break to match the scope


Author: Richard Hodges <hodges.r@gmail.com>
Date: Tue, 31 Jul 2018 13:55:14 +0100
Raw View
--00000000000076eae505724b179f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, 31 Jul 2018 at 09:55, <florian.csdt@gmail.com> wrote:

>
>
> 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,
>> 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 availab=
le
>> 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 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
>> 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 opt=
ion
>> 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 variabl=
e
>> - 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 w=
ay
>> 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.
>>
>>
> 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
>

We already have this:


int foo(int);

int main()
{
 for_label: for (int i =3D 0 ; i < 3 ; i++) {
  switch (i) {
  case 1:
   for (int j =3D 0 ; j < 3 ; ++j ) {
    if (foo(j*i) > 0) break; // breaks the innermost loop
    if (foo(j*i) < 0) goto exit_switch; // breaks the switch
    if (foo(j*i) =3D=3D 0) goto exit_for; // breaks the outermost loop
   }
  }
  exit_switch: ;
 }
 exit_for: ;
}



> --
> 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/8d2cbc8d-f5d=
1-4cb1-9cdb-d2b50b0794ca%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8d2cbc8d-f5=
d1-4cb1-9cdb-d2b50b0794ca%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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/CALvx3haR43sxLmDBNTYgcSYcEGbtdOtML5k8piDC%3DSfjQ=
G3-5A%40mail.gmail.com.

--00000000000076eae505724b179f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue=
, 31 Jul 2018 at 09:55, &lt;<a href=3D"mailto:florian.csdt@gmail.com">flori=
an.csdt@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote"=
 style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><d=
iv dir=3D"ltr"><br><br>Le mardi 31 juillet 2018 09:29:59 UTC+2, John Dogget=
t a =C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin:0;ma=
rgin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"lt=
r"><div style=3D"font-family:arial,sans-serif;font-size:small">Given that y=
ou can use a=C2=A0<font face=3D"monospace, monospace">continue</font>=C2=A0=
statement from within a switch block, it is inconsistent that you cannot ap=
ply a=C2=A0<font face=3D"monospace, monospace">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 should be possible to select whether=
 a=C2=A0<font face=3D"monospace, monospace">break</font>=C2=A0statement ass=
ociates with a loop or a switch block.</div><br><br></div><div style=3D"fon=
t-family:arial,sans-serif;font-size:small"><b>The problem it solves:</b></d=
iv><div style=3D"font-family:arial,sans-serif;font-size:small"><b><span sty=
le=3D"font-weight:400">When implemented state machines, t</span><span style=
=3D"font-weight:400">here have been times when I have had to write a code k=
ludge, when an elegant solution would have been available if only the break=
 wasn&#39;t swallowed by the switch block which was testing whether the loo=
p should be exited.</span>=C2=A0</b>=C2=A0<br></div><div style=3D"font-fami=
ly:arial,sans-serif;font-size:small"><div><br></div><div>State machines oft=
en simply map on to a loop containing a switch statement. And it is annoyin=
g that while you can=C2=A0<font face=3D"monospace, monospace">continue</fon=
t>=C2=A0the loop=C2=A0from=C2=A0within the switch you cannot=C2=A0<span sty=
le=3D"font-family:monospace,monospace">break</span>=C2=A0the loop from with=
in the switch.<br></div><div><br></div><div>It is tempting to think that en=
gineers have not particularly missed this functionality over the decades. B=
ut what elegant solutions have not become common practise due to engineers =
not having the functionality available? Being forced to write a kludge in y=
our code makes you reach for other solutions.</div><div><br></div><div>I be=
lieve in symmetry, so while I do not feel a strong need to break out of swi=
tch statements when a loop will swallow the break, I think the option shoul=
d be supplied.</div><div><br><div>There are a number of possible solutions:=
</div><div><br></div><div><b>My preferred solution:</b>=C2=A0As this is aim=
ed at C style programming I think it should look like C rather than C++:</d=
iv><div><br></div><div style=3D"font-size:12.8px"><div style=3D"font-size:s=
mall"><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:sm=
all"><font face=3D"monospace, monospace"><br></font></div><div style=3D"fon=
t-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 statement. =
*/</span><br></div><div style=3D"font-size:small"><font face=3D"monospace, =
monospace"><br></font></div><div style=3D"font-size:small"><font face=3D"mo=
nospace, monospace">break.switch; /* break out of a switch,=C2=A0</font><sp=
an style=3D"font-family:monospace,monospace">even if you are in a</span></d=
iv><div style=3D"font-size:small"><span style=3D"font-family:monospace,mono=
space">=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,monospace"><=
br></span></div><div style=3D"font-size:small"><br></div><div><b>Other alte=
rnatives considered:</b><br></div>But there are numerous other possible sol=
utions like:<br></div><div><br></div><div>Pseudo namespaces:</div><div><fon=
t face=3D"monospace, monospace">break;</font></div><div><font face=3D"monos=
pace, monospace">break::loop;</font></div><div><font face=3D"monospace, mon=
ospace">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><span style=3D"font-family:monospace,mo=
nospace">while::break;=C2=A0</span><span style=3D"font-family:monospace,mon=
ospace">switch::break;)</span></div><div>Glimpsing &quot;::&quot; in a bloc=
k of code could give the impression that a C++ style solution was being use=
d, when this suggestion slots in with=C2=A0traditional C.</div><div><br></d=
iv><div>Or pseudo function calls like break(loop) - looks like loop is a va=
riable - I prefer other options.</div><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 - &quot;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 written that way. Using a goto may actually =
be a cleaner way of achieving the same goal.</div><div><br></div><div>Intro=
ducing loop type discrimination could offer limited support for a nestled l=
oop 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><div><b=
r></div><div><b>Impact on portability</b>:</div><div>If I was given the tas=
k of porting code written with=C2=A0<font face=3D"monospace, monospace">bre=
ak.loop</font>=C2=A0commands to a computer that only had a K&amp;R C compil=
er, I would swear rather than enter depression.</div><div style=3D"font-siz=
e:12.8px"></div><br></div></div></div></blockquote><div><br></div><div>I gi=
ve you an alternative:</div><div><div style=3D"background-color:rgb(250,250=
,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px" cl=
ass=3D"m_-3523280871122105728prettyprint"><code class=3D"m_-352328087112210=
5728prettyprint"><div class=3D"m_-3523280871122105728subprettyprint"><span =
style=3D"color:#000" class=3D"m_-3523280871122105728styled-by-prettify">for=
_label</span><span style=3D"color:#660" class=3D"m_-3523280871122105728styl=
ed-by-prettify">:</span><span style=3D"color:#000" class=3D"m_-352328087112=
2105728styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-3=
523280871122105728styled-by-prettify">for</span><span style=3D"color:#000" =
class=3D"m_-3523280871122105728styled-by-prettify"> </span><span style=3D"c=
olor:#660" class=3D"m_-3523280871122105728styled-by-prettify">(...)</span><=
span style=3D"color:#000" class=3D"m_-3523280871122105728styled-by-prettify=
"> </span><span style=3D"color:#660" class=3D"m_-3523280871122105728styled-=
by-prettify">{</span><span style=3D"color:#000" class=3D"m_-352328087112210=
5728styled-by-prettify"><br>=C2=A0 switch_label</span><span style=3D"color:=
#660" class=3D"m_-3523280871122105728styled-by-prettify">:</span><span styl=
e=3D"color:#000" class=3D"m_-3523280871122105728styled-by-prettify"> </span=
><span style=3D"color:#008" class=3D"m_-3523280871122105728styled-by-pretti=
fy">switch</span><span style=3D"color:#000" class=3D"m_-3523280871122105728=
styled-by-prettify"> </span><span style=3D"color:#660" class=3D"m_-35232808=
71122105728styled-by-prettify">(...)</span><span style=3D"color:#000" class=
=3D"m_-3523280871122105728styled-by-prettify"> </span><span style=3D"color:=
#660" class=3D"m_-3523280871122105728styled-by-prettify">{</span><span styl=
e=3D"color:#000" class=3D"m_-3523280871122105728styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-352328087112210572=
8styled-by-prettify">case</span><span style=3D"color:#000" class=3D"m_-3523=
280871122105728styled-by-prettify"> </span><span style=3D"color:#660" class=
=3D"m_-3523280871122105728styled-by-prettify">...:</span><span style=3D"col=
or:#000" class=3D"m_-3523280871122105728styled-by-prettify"><br>=C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-352328087112210572=
8styled-by-prettify">for</span><span style=3D"color:#000" class=3D"m_-35232=
80871122105728styled-by-prettify"> </span><span style=3D"color:#660" class=
=3D"m_-3523280871122105728styled-by-prettify">(...)</span><span style=3D"co=
lor:#000" class=3D"m_-3523280871122105728styled-by-prettify"> </span><span =
style=3D"color:#660" class=3D"m_-3523280871122105728styled-by-prettify">{</=
span><span style=3D"color:#000" class=3D"m_-3523280871122105728styled-by-pr=
ettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008" c=
lass=3D"m_-3523280871122105728styled-by-prettify">if</span><span style=3D"c=
olor:#000" class=3D"m_-3523280871122105728styled-by-prettify"> </span><span=
 style=3D"color:#660" class=3D"m_-3523280871122105728styled-by-prettify">(.=
...)</span><span style=3D"color:#000" class=3D"m_-3523280871122105728styled-=
by-prettify"> </span><span style=3D"color:#008" class=3D"m_-352328087112210=
5728styled-by-prettify">break</span><span style=3D"color:#660" class=3D"m_-=
3523280871122105728styled-by-prettify">;</span><span style=3D"color:#000" c=
lass=3D"m_-3523280871122105728styled-by-prettify"> </span><span style=3D"co=
lor:#800" class=3D"m_-3523280871122105728styled-by-prettify">// breaks the =
innermost loop</span><span style=3D"color:#000" class=3D"m_-352328087112210=
5728styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:#008" class=3D"m_-3523280871122105728styled-by-prettify">if</span=
><span style=3D"color:#000" class=3D"m_-3523280871122105728styled-by-pretti=
fy"> </span><span style=3D"color:#660" class=3D"m_-3523280871122105728style=
d-by-prettify">(...)</span><span style=3D"color:#000" class=3D"m_-352328087=
1122105728styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m=
_-3523280871122105728styled-by-prettify">break</span><span style=3D"color:#=
660" class=3D"m_-3523280871122105728styled-by-prettify">(</span><span style=
=3D"color:#000" class=3D"m_-3523280871122105728styled-by-prettify">switch_l=
abel</span><span style=3D"color:#660" class=3D"m_-3523280871122105728styled=
-by-prettify">);</span><span style=3D"color:#000" class=3D"m_-3523280871122=
105728styled-by-prettify"> </span><span style=3D"color:#800" class=3D"m_-35=
23280871122105728styled-by-prettify">// breaks the switch</span><span style=
=3D"color:#000" class=3D"m_-3523280871122105728styled-by-prettify"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-3523=
280871122105728styled-by-prettify">if</span><span style=3D"color:#000" clas=
s=3D"m_-3523280871122105728styled-by-prettify"> </span><span style=3D"color=
:#660" class=3D"m_-3523280871122105728styled-by-prettify">(...)</span><span=
 style=3D"color:#000" class=3D"m_-3523280871122105728styled-by-prettify"> <=
/span><span style=3D"color:#008" class=3D"m_-3523280871122105728styled-by-p=
rettify">break</span><span style=3D"color:#660" class=3D"m_-352328087112210=
5728styled-by-prettify">(</span><span style=3D"color:#000" class=3D"m_-3523=
280871122105728styled-by-prettify">for_label</span><span style=3D"color:#66=
0" class=3D"m_-3523280871122105728styled-by-prettify">);</span><span style=
=3D"color:#000" class=3D"m_-3523280871122105728styled-by-prettify"> </span>=
<span style=3D"color:#800" class=3D"m_-3523280871122105728styled-by-prettif=
y">// breaks the outermost loop</span><span style=3D"color:#000" class=3D"m=
_-3523280871122105728styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 </span><s=
pan style=3D"color:#660" class=3D"m_-3523280871122105728styled-by-prettify"=
>}</span><span style=3D"color:#000" class=3D"m_-3523280871122105728styled-b=
y-prettify"><br>=C2=A0 </span><span style=3D"color:#660" class=3D"m_-352328=
0871122105728styled-by-prettify">}</span><span style=3D"color:#000" class=
=3D"m_-3523280871122105728styled-by-prettify"><br></span><span style=3D"col=
or:#660" class=3D"m_-3523280871122105728styled-by-prettify">}</span><span s=
tyle=3D"color:#000" class=3D"m_-3523280871122105728styled-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 cont=
inue<br></div></div></blockquote><div><br></div><div><font face=3D"arial, h=
elvetica, sans-serif">We already have this:</font></div><div><br></div><div=
><div style=3D"color:rgb(0,0,0);background-color:rgb(255,255,254)"><br><div=
><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,255)">int=
</span><span style=3D"color:rgb(0,0,0)"> foo(</span><span style=3D"color:rg=
b(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)">);</span></font></di=
v><font face=3D"monospace, monospace"><br></font><div><font face=3D"monospa=
ce, monospace"><span style=3D"color:rgb(0,0,255)">int</span><span style=3D"=
color:rgb(0,0,0)"> main()</span></font></div><div><span style=3D"color:rgb(=
0,0,0)"><font face=3D"monospace, monospace">{</font></span></div><div><font=
 face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">=C2=A0for_l=
abel: </span><span style=3D"color:rgb(0,0,255)">for</span><span style=3D"co=
lor:rgb(0,0,0)"> (</span><span style=3D"color:rgb(0,0,255)">int</span><span=
 style=3D"color:rgb(0,0,0)"> i =3D </span><span style=3D"color:rgb(9,136,90=
)">0</span><span style=3D"color:rgb(0,0,0)"> ; i &lt; </span><span style=3D=
"color:rgb(9,136,90)">3</span><span style=3D"color:rgb(0,0,0)"> ; i++) {</s=
pan></font></div><div><font face=3D"monospace, monospace"><span style=3D"co=
lor:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 switch</sp=
an><span style=3D"color:rgb(0,0,0)"> (i) {</span></font></div><div><font fa=
ce=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><span s=
tyle=3D"color:rgb(0,0,255)">=C2=A0 case</span><span style=3D"color:rgb(0,0,=
0)"> </span><span style=3D"color:rgb(9,136,90)">1</span><span style=3D"colo=
r:rgb(0,0,0)">:</span></font></div><div><font face=3D"monospace, monospace"=
><span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)"=
>=C2=A0 =C2=A0for</span><span style=3D"color:rgb(0,0,0)"> (</span><span sty=
le=3D"color:rgb(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)"> j =3D=
 </span><span style=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rg=
b(0,0,0)"> ; j &lt; </span><span style=3D"color:rgb(9,136,90)">3</span><spa=
n style=3D"color:rgb(0,0,0)"> ; ++j ) {</span></font></div><div><font face=
=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><span sty=
le=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><span style=3D"color:rgb(0=
,0,0)"> (foo(j*i) &gt; </span><span style=3D"color:rgb(9,136,90)">0</span><=
span style=3D"color:rgb(0,0,0)">) </span><span style=3D"color:rgb(0,0,255)"=
>break</span><span style=3D"color:rgb(0,0,0)">; </span><span style=3D"color=
:rgb(0,128,0)">// breaks the innermost loop=C2=A0 =C2=A0</span></font></div=
><div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">=
</span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><span styl=
e=3D"color:rgb(0,0,0)"> (foo(j*i) &lt; </span><span style=3D"color:rgb(9,13=
6,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span style=3D"col=
or:rgb(0,0,255)">goto</span><span style=3D"color:rgb(0,0,0)"> exit_switch; =
</span><span style=3D"color:rgb(0,128,0)">// breaks the switch</span></font=
></div><div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,=
0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><spa=
n style=3D"color:rgb(0,0,0)"> (foo(j*i) =3D=3D </span><span style=3D"color:=
rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span styl=
e=3D"color:rgb(0,0,255)">goto</span><span style=3D"color:rgb(0,0,0)"> exit_=
for; </span><span style=3D"color:rgb(0,128,0)">// breaks the outermost loop=
</span></font></div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"mon=
ospace, monospace">=C2=A0 =C2=A0}</font></span></div><div><span style=3D"co=
lor:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=A0 }</font></span><=
/div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospa=
ce">=C2=A0 exit_switch: ;</font></span></div><div><span style=3D"color:rgb(=
0,0,0)"><font face=3D"monospace, monospace">=C2=A0}</font></span></div><div=
><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=
=A0exit_for: ;</font></span></div><div><span style=3D"color:rgb(0,0,0)"><fo=
nt face=3D"monospace, monospace">}</font></span></div><br></div>=C2=A0<br><=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8d2cbc8d-f5d1-=
4cb1-9cdb-d2b50b0794ca%40isocpp.org</a>.<br>
</blockquote></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/CALvx3haR43sxLmDBNTYgcSYcEGbtdOtML5k8=
piDC%3DSfjQG3-5A%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3haR43sxLm=
DBNTYgcSYcEGbtdOtML5k8piDC%3DSfjQG3-5A%40mail.gmail.com</a>.<br />

--00000000000076eae505724b179f--

.


Author: florian.csdt@gmail.com
Date: Tue, 31 Jul 2018 06:01:05 -0700 (PDT)
Raw View
------=_Part_11391_757787379.1533042065464
Content-Type: multipart/alternative;
 boundary="----=_Part_11392_1358563468.1533042065465"

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



Le mardi 31 juillet 2018 14:55:27 UTC+2, Richard Hodges a =C3=A9crit :
>
>
>
> On Tue, 31 Jul 2018 at 09:55, <floria...@gmail.com <javascript:>> wrote:
>
>>
>>
>> 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 statemen=
t=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=
=20
>>> to write a code kludge, when an elegant solution would have been availa=
ble=20
>>> if only the break wasn't swallowed by the switch block which was testin=
g=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 thi=
s=20
>>> functionality over the decades. But what elegant solutions have not bec=
ome=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 ou=
t=20
>>> of switch statements when a loop will swallow the break, I think the op=
tion=20
>>> should be supplied.
>>>
>>> There are a number of possible solutions:
>>>
>>> *My preferred solution:* As this is aimed at C style programming I=20
>>> 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=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=20
>>> variable - I prefer other options.
>>> Or new keywords could be added: break_loop, and break_switch - and brea=
k=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 t=
o=20
>>> maintain code written that way. Using a goto may actually be a cleaner =
way=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=20
>>> break.for, and break.while. However more care would be required when=20
>>> refactoring loops.
>>>
>>> *Impact on portability*:
>>> If I was given the task of porting code written with break.loop command=
s=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
>>
>
> We already have this:
>
>
> int foo(int);
>
> int main()
> {
>  for_label: for (int i =3D 0 ; i < 3 ; i++) {
>   switch (i) {
>   case 1:
>    for (int j =3D 0 ; j < 3 ; ++j ) {
>     if (foo(j*i) > 0) break; // breaks the innermost loop  =20
>     if (foo(j*i) < 0) goto exit_switch; // breaks the switch
>     if (foo(j*i) =3D=3D 0) goto exit_for; // breaks the outermost loop
>    }
>   }
>   exit_switch: ;
>  }
>  exit_for: ;
> }
>
> =20
>

In theory, I agree, but you bypass the language doing that. It is fine in=
=20
C, but if you do it in C++, you might skip destructors:
for(int i =3D 0; i < n; i++) {
  std::vector<int> v(i);
  switch (...) {
    case ...:
      goto end_for; // oups, destructor of v is not called
  }
}
end_for: ;


--=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/f6dddde5-f738-4ef6-abfc-ff9552601cc5%40isocpp.or=
g.

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

<div dir=3D"ltr"><br><br>Le mardi 31 juillet 2018 14:55:27 UTC+2, Richard H=
odges 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 =
dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue, 31 =
Jul 2018 at 09:55, &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfusc=
ated-mailto=3D"OU-liAhNEQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#=
39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#=
39;;return true;">floria...@gmail.com</a>&gt; wrote:<br></div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;=
padding-left:1ex"><div dir=3D"ltr"><br><br>Le mardi 31 juillet 2018 09:29:5=
9 UTC+2, John Doggett 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 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"monospace, monospace">c=
ontinue</font>=C2=A0statement from within a switch block, it is inconsisten=
t that you cannot apply a=C2=A0<font face=3D"monospace, monospace">break</f=
ont>=C2=A0statement to the same loop.<br></div><div style=3D"font-family:ar=
ial,sans-serif;font-size:small"><div><br>I propose that it should be possib=
le 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><br></d=
iv><div style=3D"font-family:arial,sans-serif;font-size:small"><b>The probl=
em 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 times when I have h=
ad to write a code kludge, when an elegant solution would have been availab=
le if only the break wasn&#39;t swallowed by the switch block which was tes=
ting whether the loop should be exited.</span>=C2=A0</b>=C2=A0<br></div><di=
v style=3D"font-family:arial,sans-serif;font-size:small"><div><br></div><di=
v>State machines often simply map on to a loop containing a switch statemen=
t. And it is annoying that while you can=C2=A0<font face=3D"monospace, mono=
space">continue</font>=C2=A0the loop=C2=A0from=C2=A0within the switch you c=
annot=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 temp=
ting to think that engineers have not particularly missed this functionalit=
y over the decades. But what elegant solutions have not become common pract=
ise due to engineers not having the functionality available? Being forced t=
o write a kludge in your code makes you reach for other solutions.</div><di=
v><br></div><div>I believe in symmetry, so while I do not feel a strong nee=
d to break out of switch statements when a loop will swallow the break, I t=
hink the option should be supplied.</div><div><br><div>There are a number o=
f possible solutions:</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,mon=
ospace">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-size:small"><font =
face=3D"monospace, monospace"><br></font></div><div style=3D"font-size:smal=
l"><font face=3D"monospace, monospace">break.switch; /* break out of a swit=
ch,=C2=A0</font><span style=3D"font-family:monospace,monospace">even if you=
 are in a</span></div><div style=3D"font-size:small"><span style=3D"font-fa=
mily: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:monospace,monospace">=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/</span><span style=3D"font-family:m=
onospace,monospace"><br></span></div><div style=3D"font-size:small"><br></d=
iv><div><b>Other alternatives considered:</b><br></div>But there are numero=
us other possible solutions like:<br></div><div><br></div><div>Pseudo names=
paces:</div><div><font face=3D"monospace, monospace">break;</font></div><di=
v><font face=3D"monospace, monospace">break::loop;</font></div><div><font f=
ace=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><span style=3D"fon=
t-family:monospace,monospace">while::<wbr>break;=C2=A0</span><span style=3D=
"font-family:monospace,monospace">switch::break;)</span></div><div>Glimpsin=
g &quot;::&quot; in a block of code could give the impression that a C++ st=
yle solution was being used, when this suggestion slots in with=C2=A0tradit=
ional C.</div><div><br></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 added: break_loop, and break_switch - and break old code=
 - I prefer other options.</div><div><div>Or use a goto - &quot;gotos consi=
dered harmful&quot; etc.</div><div>Or ...<br></div><div><br></div><b>How th=
is 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 brea=
k 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 limit=
ed support for a nestled loop break. So in addition to=C2=A0<font face=3D"m=
onospace, monospace">break.loop</font>, you could have=C2=A0<font face=3D"m=
onospace, monospace">break.for</font>, and=C2=A0<font face=3D"monospace, mo=
nospace">break.while</font>. However more care would be required when refac=
toring 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 o=
nly had a K&amp;R C compiler, I would swear rather than enter depression.</=
div><div style=3D"font-size:12.8px"></div><br></div></div></div></blockquot=
e><div><br></div><div>I give you an alternative:</div><div><div style=3D"ba=
ckground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:=
solid;border-width:1px"><code><div><span style=3D"color:#000">for_label</sp=
an><span style=3D"color:#660">:</span><span style=3D"color:#000"> </span><s=
pan style=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_l=
abel</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"colo=
r:#000"> </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>=
<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 =C2=A0 =C2=A0 </span><span style=3D"=
color:#008">if</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#660">(...)</span><span style=3D"color:#000"> </span><span style=3D"color=
:#008">break</span><span style=3D"color:#660">;</span><span style=3D"color:=
#000"> </span><span style=3D"color:#800">// breaks the innermost loop</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span st=
yle=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"color:#008">break</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">switch_label</span><span style=3D"color:#660">);</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#800">// breaks the swi=
tch</span><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><sp=
an style=3D"color:#660">(...)</span><span style=3D"color:#000"> </span><spa=
n style=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 style=3D"color:#000"> </span><span style=3D"color:#800">// breaks the =
outermost 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 </span><span style=3D"color:#660">}</span><span style=3D"color:#000"><b=
r></span><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 want to break.</div><div>Of course, you can also imagine that for cont=
inue<br></div></div></blockquote><div><br></div><div><font face=3D"arial, h=
elvetica, sans-serif">We already have this:</font></div><div><br></div><div=
><div style=3D"color:rgb(0,0,0);background-color:rgb(255,255,254)"><br><div=
><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,255)">int=
</span><span style=3D"color:rgb(0,0,0)"> foo(</span><span style=3D"color:rg=
b(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)">);</span></font></di=
v><font face=3D"monospace, monospace"><br></font><div><font face=3D"monospa=
ce, monospace"><span style=3D"color:rgb(0,0,255)">int</span><span style=3D"=
color:rgb(0,0,0)"> main()</span></font></div><div><span style=3D"color:rgb(=
0,0,0)"><font face=3D"monospace, monospace">{</font></span></div><div><font=
 face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">=C2=A0for_l=
abel: </span><span style=3D"color:rgb(0,0,255)">for</span><span style=3D"co=
lor:rgb(0,0,0)"> (</span><span style=3D"color:rgb(0,0,255)">int</span><span=
 style=3D"color:rgb(0,0,0)"> i =3D </span><span style=3D"color:rgb(9,136,90=
)">0</span><span style=3D"color:rgb(0,0,0)"> ; i &lt; </span><span style=3D=
"color:rgb(9,136,90)">3</span><span style=3D"color:rgb(0,0,0)"> ; i++) {</s=
pan></font></div><div><font face=3D"monospace, monospace"><span style=3D"co=
lor:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 switch</sp=
an><span style=3D"color:rgb(0,0,0)"> (i) {</span></font></div><div><font fa=
ce=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><span s=
tyle=3D"color:rgb(0,0,255)">=C2=A0 case</span><span style=3D"color:rgb(0,0,=
0)"> </span><span style=3D"color:rgb(9,136,90)">1</span><span style=3D"colo=
r:rgb(0,0,0)">:</span></font></div><div><font face=3D"monospace, monospace"=
><span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)"=
>=C2=A0 =C2=A0for</span><span style=3D"color:rgb(0,0,0)"> (</span><span sty=
le=3D"color:rgb(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)"> j =3D=
 </span><span style=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rg=
b(0,0,0)"> ; j &lt; </span><span style=3D"color:rgb(9,136,90)">3</span><spa=
n style=3D"color:rgb(0,0,0)"> ; ++j ) {</span></font></div><div><font face=
=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><span sty=
le=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><span style=3D"color:rgb(0=
,0,0)"> (foo(j*i) &gt; </span><span style=3D"color:rgb(9,136,90)">0</span><=
span style=3D"color:rgb(0,0,0)">) </span><span style=3D"color:rgb(0,0,255)"=
>break</span><span style=3D"color:rgb(0,0,0)">; </span><span style=3D"color=
:rgb(0,128,0)">// breaks the innermost loop=C2=A0 =C2=A0</span></font></div=
><div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">=
</span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><span styl=
e=3D"color:rgb(0,0,0)"> (foo(j*i) &lt; </span><span style=3D"color:rgb(9,13=
6,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span style=3D"col=
or:rgb(0,0,255)">goto</span><span style=3D"color:rgb(0,0,0)"> exit_switch; =
</span><span style=3D"color:rgb(0,128,0)">// breaks the switch</span></font=
></div><div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,=
0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><spa=
n style=3D"color:rgb(0,0,0)"> (foo(j*i) =3D=3D </span><span style=3D"color:=
rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span styl=
e=3D"color:rgb(0,0,255)">goto</span><span style=3D"color:rgb(0,0,0)"> exit_=
for; </span><span style=3D"color:rgb(0,128,0)">// breaks the outermost loop=
</span></font></div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"mon=
ospace, monospace">=C2=A0 =C2=A0}</font></span></div><div><span style=3D"co=
lor:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=A0 }</font></span><=
/div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospa=
ce">=C2=A0 exit_switch: ;</font></span></div><div><span style=3D"color:rgb(=
0,0,0)"><font face=3D"monospace, monospace">=C2=A0}</font></span></div><div=
><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=
=A0exit_for: ;</font></span></div><div><span style=3D"color:rgb(0,0,0)"><fo=
nt face=3D"monospace, monospace">}</font></span></div><br></div>=C2=A0</div=
></div></div></blockquote><div><br></div><div>In theory, I agree, but you b=
ypass the language doing that. It is fine in C, but if you do it in C++, yo=
u might skip destructors:</div><div><div style=3D"background-color: rgb(250=
, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-=
width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">for</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> i </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> i </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> n</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> i</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><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 std</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">vector</span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&lt;int&gt;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> v</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">i</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">switch</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 =C2=A0 <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">case</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">...:</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">goto</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> end_for</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">// oups, destructor of v is not called</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>end_for</span><span style=3D"colo=
r: #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><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span></div></code></div><br><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/f6dddde5-f738-4ef6-abfc-ff9552601cc5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f6dddde5-f738-4ef6-abfc-ff9552601cc5=
%40isocpp.org</a>.<br />

------=_Part_11392_1358563468.1533042065465--

------=_Part_11391_757787379.1533042065464--

.


Author: florian.csdt@gmail.com
Date: Tue, 31 Jul 2018 06:11:02 -0700 (PDT)
Raw View
------=_Part_11553_1981471774.1533042662977
Content-Type: multipart/alternative;
 boundary="----=_Part_11554_1539321177.1533042662978"

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



Le mardi 31 juillet 2018 15:01:05 UTC+2, floria...@gmail.com a =C3=A9crit :
>
>
>
> Le mardi 31 juillet 2018 14:55:27 UTC+2, Richard Hodges a =C3=A9crit :
>>
>>
>>
>> On Tue, 31 Jul 2018 at 09:55, <floria...@gmail.com> wrote:
>>
>>>
>>>
>>> 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=20
>>>> block, it is inconsistent that you cannot apply a break statement to=
=20
>>>> the same loop.
>>>>
>>>> I propose that it should be possible to select whether a break stateme=
nt=20
>>>> associates with a loop or a switch block.
>>>>
>>>>
>>>> *The problem it solves:*
>>>> *When implemented state machines, there have been times when I have ha=
d=20
>>>> to write a code kludge, when an elegant solution would have been avail=
able=20
>>>> if only the break wasn't swallowed by the switch block which was testi=
ng=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=20
>>>> this functionality over the decades. But what elegant solutions have n=
ot=20
>>>> become common practise due to engineers not having the functionality=
=20
>>>> available? Being forced to write a kludge in your code makes you reach=
 for=20
>>>> other solutions.
>>>>
>>>> I believe in symmetry, so while I do not feel a strong need to break=
=20
>>>> out of switch statements when a loop will swallow the break, I think t=
he=20
>>>> option should be supplied.
>>>>
>>>> There are a number of possible solutions:
>>>>
>>>> *My preferred solution:* As this is aimed at C style programming I=20
>>>> 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=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=20
>>>> variable - I prefer other options.
>>>> Or new keywords could be added: break_loop, and break_switch - and=20
>>>> 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=
=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=
 way=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=20
>>>> break.for, and break.while. However more care would be required when=
=20
>>>> refactoring loops.
>>>>
>>>> *Impact on portability*:
>>>> If I was given the task of porting code written with break.loop comman=
ds=20
>>>> to a computer that only had a K&R C compiler, I would swear rather tha=
n=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
>>>
>>
>> We already have this:
>>
>>
>> int foo(int);
>>
>> int main()
>> {
>>  for_label: for (int i =3D 0 ; i < 3 ; i++) {
>>   switch (i) {
>>   case 1:
>>    for (int j =3D 0 ; j < 3 ; ++j ) {
>>     if (foo(j*i) > 0) break; // breaks the innermost loop  =20
>>     if (foo(j*i) < 0) goto exit_switch; // breaks the switch
>>     if (foo(j*i) =3D=3D 0) goto exit_for; // breaks the outermost loop
>>    }
>>   }
>>   exit_switch: ;
>>  }
>>  exit_for: ;
>> }
>>
>> =20
>>
>
> In theory, I agree, but you bypass the language doing that. It is fine in=
=20
> C, but if you do it in C++, you might skip destructors:
> for(int i =3D 0; i < n; i++) {
>   std::vector<int> v(i);
>   switch (...) {
>     case ...:
>       goto end_for; // oups, destructor of v is not called
>   }
> }
> end_for: ;
>
>
Sorry, I just checked and destructors are actually called when goto is=20
executed. I'm happily surprised.
So you're completely right, it is already possible and I have nothing to=20
add.

--=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/fc24d538-0151-4625-a61e-cfe1f5186c2b%40isocpp.or=
g.

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

<div dir=3D"ltr"><br><br>Le mardi 31 juillet 2018 15:01:05 UTC+2, floria...=
@gmail.com a =C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">=
<div dir=3D"ltr"><br><br>Le mardi 31 juillet 2018 14:55:27 UTC+2, Richard H=
odges 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 dir=
=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue, 31 Jul=
 2018 at 09:55, &lt;<a rel=3D"nofollow">floria...@gmail.com</a>&gt; wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><br>Le mardi 3=
1 juillet 2018 09:29:59 UTC+2, John Doggett 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 dir=3D"ltr"><div style=3D"font-family:aria=
l,sans-serif;font-size:small">Given that you can use a=C2=A0<font face=3D"m=
onospace, monospace">continue</font>=C2=A0statement from within a switch bl=
ock, it is inconsistent that you cannot apply a=C2=A0<font face=3D"monospac=
e, monospace">break</font>=C2=A0statement to the same loop.<br></div><div s=
tyle=3D"font-family:arial,sans-serif;font-size:small"><div><br>I propose th=
at 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 b=
lock.</div><br><br></div><div style=3D"font-family:arial,sans-serif;font-si=
ze:small"><b>The problem it solves:</b></div><div style=3D"font-family:aria=
l,sans-serif;font-size:small"><b><span style=3D"font-weight:400">When imple=
mented state machines, t</span><span style=3D"font-weight:400">here have be=
en times when I have had to write a code kludge, when an elegant solution w=
ould have been available if only the break wasn&#39;t swallowed by the swit=
ch block 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:sma=
ll"><div><br></div><div>State machines often simply map on to a loop contai=
ning a switch statement. And it is annoying that while you can=C2=A0<font f=
ace=3D"monospace, monospace">continue</font>=C2=A0the loop=C2=A0from=C2=A0w=
ithin the switch you cannot=C2=A0<span style=3D"font-family:monospace,monos=
pace">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 mis=
sed this functionality over the decades. But what elegant solutions have no=
t become common practise due to engineers not having the functionality avai=
lable? Being forced to write a kludge in your code makes you reach for othe=
r solutions.</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 s=
wallow 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 p=
referred 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"f=
ont-size:12.8px"><div style=3D"font-size:small"><font face=3D"monospace, mo=
nospace">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, mon=
ospace"><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 statement. */</span><br></div><div style=3D"fo=
nt-size:small"><font face=3D"monospace, monospace"><br></font></div><div st=
yle=3D"font-size:small"><font face=3D"monospace, monospace">break.switch; /=
* break out of a switch,=C2=A0</font><span style=3D"font-family:monospace,m=
onospace">even if you are in a</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* loop within a switch statement.</span></div><d=
iv 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 sty=
le=3D"font-family:monospace,monospace"><br></span></div><div style=3D"font-=
size:small"><br></div><div><b>Other alternatives considered:</b><br></div>B=
ut there are numerous other possible solutions like:<br></div><div><br></di=
v><div>Pseudo namespaces:</div><div><font face=3D"monospace, monospace">bre=
ak;</font></div><div><font face=3D"monospace, monospace">break::loop;</font=
></div><div><font face=3D"monospace, monospace">break::switch;</font></div>=
<div><font face=3D"monospace, monospace">(or the other way around:=C2=A0</f=
ont><span style=3D"font-family:monospace,monospace">for::break;=C2=A0</span=
><span 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 impre=
ssion that a C++ style solution was being used, when this suggestion slots =
in with=C2=A0traditional C.</div><div><br></div><div>Or pseudo function cal=
ls like break(loop) - looks like loop is a variable - I prefer other option=
s.</div><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 =
- &quot;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 ne=
stled 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 discriminatio=
n could 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 b=
e required when refactoring loops.</div><div><br></div><div><b>Impact on po=
rtability</b>:</div><div>If I was given the task of porting code written wi=
th=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 tha=
n enter depression.</div><div style=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-color:rgb(250,250,250);border-color:rgb(187,1=
87,187);border-style:solid;border-width:1px"><code><div><span style=3D"colo=
r:#000">for_label</span><span style=3D"color:#660">:</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#008">for</span><span style=3D"colo=
r:#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 st=
yle=3D"color:#000"> </span><span style=3D"color:#008">switch</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#660">(...)</span><span sty=
le=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:#000"> </span><span style=3D"color:#660">...:</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"co=
lor:#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 =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"color:#008">break</span><span style=3D"color:#660">;</span><=
span style=3D"color:#000"> </span><span style=3D"color:#800">// breaks the =
innermost loop</span><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 style=3D"color:#660">(...)</span><span style=3D"color:#000"=
> </span><span style=3D"color:#008">break</span><span style=3D"color:#660">=
(</span><span style=3D"color:#000">switch_label</span><span style=3D"color:=
#660">);</span><span style=3D"color:#000"> </span><span style=3D"color:#800=
">// breaks the switch</span><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"col=
or:#000"> </span><span style=3D"color:#660">(...)</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#008">break</span><span style=3D"color=
:#660">(</span><span style=3D"color:#000">for_label</span><span style=3D"co=
lor:#660">);</span><span style=3D"color:#000"> </span><span style=3D"color:=
#800">// breaks the outermost 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 </span><span style=3D"color:#660">}</span><span styl=
e=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span style=
=3D"color:#000"><br></span></div></code></div><br> Like, you can safely spe=
cify which structure you want to break.</div><div>Of course, you can also i=
magine that for continue<br></div></div></blockquote><div><br></div><div><f=
ont face=3D"arial, helvetica, sans-serif">We already have this:</font></div=
><div><br></div><div><div style=3D"color:rgb(0,0,0);background-color:rgb(25=
5,255,254)"><br><div><font face=3D"monospace, monospace"><span style=3D"col=
or:rgb(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)"> foo(</span><sp=
an style=3D"color:rgb(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)">=
);</span></font></div><font face=3D"monospace, monospace"><br></font><div><=
font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,255)">int</=
span><span style=3D"color:rgb(0,0,0)"> main()</span></font></div><div><span=
 style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">{</font></s=
pan></div><div><font face=3D"monospace, monospace"><span style=3D"color:rgb=
(0,0,0)">=C2=A0for_label: </span><span style=3D"color:rgb(0,0,255)">for</sp=
an><span style=3D"color:rgb(0,0,0)"> (</span><span style=3D"color:rgb(0,0,2=
55)">int</span><span style=3D"color:rgb(0,0,0)"> i =3D </span><span style=
=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)"> ; i &lt;=
 </span><span style=3D"color:rgb(9,136,90)">3</span><span style=3D"color:rg=
b(0,0,0)"> ; i++) {</span></font></div><div><font face=3D"monospace, monosp=
ace"><span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,2=
55)">=C2=A0 switch</span><span style=3D"color:rgb(0,0,0)"> (i) {</span></fo=
nt></div><div><font face=3D"monospace, monospace"><span style=3D"color:rgb(=
0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 case</span><span s=
tyle=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(9,136,90)">1</sp=
an><span style=3D"color:rgb(0,0,0)">:</span></font></div><div><font face=3D=
"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><span style=
=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0for</span><span style=3D"color:rgb(0,0=
,0)"> (</span><span style=3D"color:rgb(0,0,255)">int</span><span style=3D"c=
olor:rgb(0,0,0)"> j =3D </span><span style=3D"color:rgb(9,136,90)">0</span>=
<span style=3D"color:rgb(0,0,0)"> ; j &lt; </span><span style=3D"color:rgb(=
9,136,90)">3</span><span style=3D"color:rgb(0,0,0)"> ; ++j ) {</span></font=
></div><div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,=
0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><spa=
n style=3D"color:rgb(0,0,0)"> (foo(j*i) &gt; </span><span style=3D"color:rg=
b(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span style=
=3D"color:rgb(0,0,255)">break</span><span style=3D"color:rgb(0,0,0)">; </sp=
an><span style=3D"color:rgb(0,128,0)">// breaks the innermost loop=C2=A0 =
=C2=A0</span></font></div><div><font face=3D"monospace, monospace"><span st=
yle=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 =
=C2=A0 if</span><span style=3D"color:rgb(0,0,0)"> (foo(j*i) &lt; </span><sp=
an style=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)">)=
 </span><span style=3D"color:rgb(0,0,255)">goto</span><span style=3D"color:=
rgb(0,0,0)"> exit_switch; </span><span style=3D"color:rgb(0,128,0)">// brea=
ks the switch</span></font></div><div><font face=3D"monospace, monospace"><=
span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=
=C2=A0 =C2=A0 if</span><span style=3D"color:rgb(0,0,0)"> (foo(j*i) =3D=3D <=
/span><span style=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rgb(=
0,0,0)">) </span><span style=3D"color:rgb(0,0,255)">goto</span><span style=
=3D"color:rgb(0,0,0)"> exit_for; </span><span style=3D"color:rgb(0,128,0)">=
// breaks the outermost loop</span></font></div><div><span style=3D"color:r=
gb(0,0,0)"><font face=3D"monospace, monospace">=C2=A0 =C2=A0}</font></span>=
</div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monosp=
ace">=C2=A0 }</font></span></div><div><span style=3D"color:rgb(0,0,0)"><fon=
t face=3D"monospace, monospace">=C2=A0 exit_switch: ;</font></span></div><d=
iv><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=
=A0}</font></span></div><div><span style=3D"color:rgb(0,0,0)"><font face=3D=
"monospace, monospace">=C2=A0exit_for: ;</font></span></div><div><span styl=
e=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">}</font></span><=
/div><br></div>=C2=A0</div></div></div></blockquote><div><br></div><div>In =
theory, I agree, but you bypass the language doing that. It is fine in C, b=
ut if you do it in C++, you might skip destructors:</div><div><div style=3D=
"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-sty=
le:solid;border-width:1px"><code><div><span style=3D"color:#008">for</span>=
<span style=3D"color:#660">(</span><span style=3D"color:#008">int</span><sp=
an style=3D"color:#000"> i </span><span style=3D"color:#660">=3D</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#066">0</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#000"> i </span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#000"> n</span><span style=
=3D"color:#660">;</span><span style=3D"color:#000"> i</span><span style=3D"=
color:#660">++)</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"><br>=C2=A0 std</span><span styl=
e=3D"color:#660">::</span><span style=3D"color:#000">vector</span><span sty=
le=3D"color:#080">&lt;int&gt;</span><span style=3D"color:#000"> v</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#000">i</span><span st=
yle=3D"color:#660">);</span><span style=3D"color:#000"><br>=C2=A0 </span><s=
pan style=3D"color:#008">switch</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#660">(...)</span><span style=3D"color:#000"> </span><sp=
an 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:#000"=
> </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">goto</span><span =
style=3D"color:#000"> end_for</span><span style=3D"color:#660">;</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#800">// oups, destruct=
or of v is not called</span><span style=3D"color:#000"><br>=C2=A0 </span><s=
pan style=3D"color:#660">}</span><span style=3D"color:#000"><br></span><spa=
n style=3D"color:#660">}</span><span style=3D"color:#000"><br>end_for</span=
><span style=3D"color:#660">:</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#660">;</span><span style=3D"color:#000"><br></span></div>=
</code></div><br></div></div></blockquote><div><br></div><div>Sorry, I just=
 checked and destructors are actually called when goto is executed. I&#39;m=
 happily surprised.</div><div>So you&#39;re completely right, it is already=
 possible and I have nothing to add.<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/fc24d538-0151-4625-a61e-cfe1f5186c2b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fc24d538-0151-4625-a61e-cfe1f5186c2b=
%40isocpp.org</a>.<br />

------=_Part_11554_1539321177.1533042662978--

------=_Part_11553_1981471774.1533042662977--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Tue, 31 Jul 2018 10:54:32 -0400
Raw View
--00000000000023bd8205724cc229
Content-Type: text/plain; charset="UTF-8"

On Tue, Jul 31, 2018 at 8:55 AM Richard Hodges <hodges.r@gmail.com> wrote:

> We already have this:
> int main()
> {
>  for_label: for (int i = 0 ; i < 3 ; i++) {
>   switch (i) {
>   case 1:
>    for (int j = 0 ; j < 3 ; ++j ) {
>     if (foo(j*i) > 0) break; // breaks the innermost loop
>     if (foo(j*i) < 0) goto exit_switch; // breaks the switch
>     if (foo(j*i) == 0) goto exit_for; // breaks the outermost loop
>    }
>   }
>   exit_switch: ;
>  }
>  exit_for: ;
> }
>

The same argument applies to existing break and continue, and yet C and C++
have them.
The point isn't that we can form arbitrary flows of control using goto.
The point is that break
and continue provide meaningful semantics to the reader, namely control
flow is either exiting
or repeating a block, whereas goto has an arbitrary destination.  This
concept is decades old.

Additionally, as can be seen in your example, the exit labels are placed
very awkwardly, while
the labels for break *label*; and continue *label*; clearly denote the
blocks addressed.
We should place these constructs into the language and then deprecate uses
*without* labels.

--
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/CAHSYqdbtOqQqZm7y8Q59nHvX%3DoKiRG8QdWKEXVkxoSP0BqXUDg%40mail.gmail.com.

--00000000000023bd8205724cc229
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue, Jul 31=
, 2018 at 8:55 AM Richard Hodges &lt;<a href=3D"mailto:hodges.r@gmail.com">=
hodges.r@gmail.com</a>&gt; wrote:</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr"><div class=3D"gmail_quote"><div><font face=3D"arial, helvetica,=
 sans-serif">We already have this:</font></div><div><div style=3D"color:rgb=
(0,0,0);background-color:rgb(255,255,254)"><div><font face=3D"monospace, mo=
nospace"><span style=3D"color:rgb(0,0,255)">int</span><span style=3D"color:=
rgb(0,0,0)"> main()</span></font></div><div><span style=3D"color:rgb(0,0,0)=
"><font face=3D"monospace, monospace">{</font></span></div><div><font face=
=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">=C2=A0for_label:=
 </span><span style=3D"color:rgb(0,0,255)">for</span><span style=3D"color:r=
gb(0,0,0)"> (</span><span style=3D"color:rgb(0,0,255)">int</span><span styl=
e=3D"color:rgb(0,0,0)"> i =3D </span><span style=3D"color:rgb(9,136,90)">0<=
/span><span style=3D"color:rgb(0,0,0)"> ; i &lt; </span><span style=3D"colo=
r:rgb(9,136,90)">3</span><span style=3D"color:rgb(0,0,0)"> ; i++) {</span><=
/font></div><div><font face=3D"monospace, monospace"><span style=3D"color:r=
gb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 switch</span><s=
pan style=3D"color:rgb(0,0,0)"> (i) {</span></font></div><div><font face=3D=
"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><span style=
=3D"color:rgb(0,0,255)">=C2=A0 case</span><span style=3D"color:rgb(0,0,0)">=
 </span><span style=3D"color:rgb(9,136,90)">1</span><span style=3D"color:rg=
b(0,0,0)">:</span></font></div><div><font face=3D"monospace, monospace"><sp=
an style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=
=A0 =C2=A0for</span><span style=3D"color:rgb(0,0,0)"> (</span><span style=
=3D"color:rgb(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)"> j =3D <=
/span><span style=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rgb(=
0,0,0)"> ; j &lt; </span><span style=3D"color:rgb(9,136,90)">3</span><span =
style=3D"color:rgb(0,0,0)"> ; ++j ) {</span></font></div><div><font face=3D=
"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><span style=
=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><span style=3D"color:rgb(0,0=
,0)"> (foo(j*i) &gt; </span><span style=3D"color:rgb(9,136,90)">0</span><sp=
an style=3D"color:rgb(0,0,0)">) </span><span style=3D"color:rgb(0,0,255)">b=
reak</span><span style=3D"color:rgb(0,0,0)">; </span><span style=3D"color:r=
gb(0,128,0)">// breaks the innermost loop=C2=A0 =C2=A0</span></font></div><=
div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></=
span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><span style=
=3D"color:rgb(0,0,0)"> (foo(j*i) &lt; </span><span style=3D"color:rgb(9,136=
,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span style=3D"colo=
r:rgb(0,0,255)">goto</span><span style=3D"color:rgb(0,0,0)"> exit_switch; <=
/span><span style=3D"color:rgb(0,128,0)">// breaks the switch</span></font>=
</div><div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0=
,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><span=
 style=3D"color:rgb(0,0,0)"> (foo(j*i) =3D=3D </span><span style=3D"color:r=
gb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span style=
=3D"color:rgb(0,0,255)">goto</span><span style=3D"color:rgb(0,0,0)"> exit_f=
or; </span><span style=3D"color:rgb(0,128,0)">// breaks the outermost loop<=
/span></font></div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"mono=
space, monospace">=C2=A0 =C2=A0}</font></span></div><div><span style=3D"col=
or:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=A0 }</font></span></=
div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospac=
e">=C2=A0 exit_switch: ;</font></span></div><div><span style=3D"color:rgb(0=
,0,0)"><font face=3D"monospace, monospace">=C2=A0}</font></span></div><div>=
<span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=A0=
exit_for: ;</font></span></div><div><span style=3D"color:rgb(0,0,0)"><font =
face=3D"monospace, monospace">}</font></span></div></div></div></div></div>=
</blockquote><div><br>The same argument applies to existing <font face=3D"m=
onospace, monospace">break</font> and <font face=3D"monospace, monospace">c=
ontinue</font>, and yet C and C++ have them.<br>The point isn&#39;t that we=
 can form arbitrary flows of control using <font face=3D"monospace, monospa=
ce">goto</font>.=C2=A0 The point is that <font face=3D"monospace, monospace=
">break</font><br>and <font face=3D"monospace, monospace">continue</font> p=
rovide meaningful semantics to the reader, namely control flow is either ex=
iting<br>or repeating a block, whereas <font face=3D"monospace, monospace">=
goto</font> has an arbitrary destination.=C2=A0 This concept is decades old=
..<br><br>Additionally, as can be seen in your example, the exit labels are =
placed very awkwardly, while<br>the labels for <font face=3D"monospace, mon=
ospace">break <i>label</i>;</font> and <font face=3D"monospace, monospace">=
continue <i>label</i>;</font> clearly denote the blocks addressed.<br>We sh=
ould place these constructs into the language and then deprecate uses <i>wi=
thout</i> labels.</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/CAHSYqdbtOqQqZm7y8Q59nHvX%3DoKiRG8QdW=
KEXVkxoSP0BqXUDg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdbtOqQqZm=
7y8Q59nHvX%3DoKiRG8QdWKEXVkxoSP0BqXUDg%40mail.gmail.com</a>.<br />

--00000000000023bd8205724cc229--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 31 Jul 2018 08:37:44 -0700 (PDT)
Raw View
------=_Part_11846_324485050.1533051464516
Content-Type: multipart/alternative;
 boundary="----=_Part_11847_1710964168.1533051464516"

------=_Part_11847_1710964168.1533051464516
Content-Type: text/plain; charset="UTF-8"

On Tuesday, July 31, 2018 at 10:54:46 AM UTC-4, Hyman Rosen wrote:
>
> On Tue, Jul 31, 2018 at 8:55 AM Richard Hodges <hodg...@gmail.com
> <javascript:>> wrote:
>
>> We already have this:
>> int main()
>> {
>>  for_label: for (int i = 0 ; i < 3 ; i++) {
>>   switch (i) {
>>   case 1:
>>    for (int j = 0 ; j < 3 ; ++j ) {
>>     if (foo(j*i) > 0) break; // breaks the innermost loop
>>     if (foo(j*i) < 0) goto exit_switch; // breaks the switch
>>     if (foo(j*i) == 0) goto exit_for; // breaks the outermost loop
>>    }
>>   }
>>   exit_switch: ;
>>  }
>>  exit_for: ;
>> }
>>
>
> The same argument applies to existing break and continue, and yet C and
> C++ have them.
> The point isn't that we can form arbitrary flows of control using goto.
> The point is that break
> and continue provide meaningful semantics to the reader, namely control
> flow is either exiting
> or repeating a block, whereas goto has an arbitrary destination.  This
> concept is decades old.
>

Sure. But that has to be balanced against how often you need such things.
After all, labeled break/continue this is only useful for highly complex
code with multiple nested looping/conditional structures. "It could be
done" is not good enough; there has to be some reason why it *should* be
done.

`goto` is an escape hatch for code structure; when you see one, a red flag
lights up to say "odd things are happening here".

Labeled `break`/`continue` don't break structure the way `goto` can. But
they don't represent good, easily digestible structure either. They're not
a full escape hatch the way `goto` is, but they still represent unusual
structure of code.

So the question is this: does this unusual structure of code happen often
enough to justify the addition of a feature to the language? And if it is
added, will it *encourage* the creation of code with unusual structures?

Additionally, as can be seen in your example, the exit labels are placed
> very awkwardly, while
> the labels for break *label*; and continue *label*; clearly denote the
> blocks addressed.
> We should place these constructs into the language and then deprecate uses
> *without* labels.
>

--
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/e0463dbc-befe-4cd7-8744-9fa9f25aa136%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, July 31, 2018 at 10:54:46 AM UTC-4, Hyman Rose=
n 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 =
class=3D"gmail_quote"><div dir=3D"ltr">On Tue, Jul 31, 2018 at 8:55 AM Rich=
ard Hodges &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mai=
lto=3D"bFqTaotTEQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javas=
cript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;retu=
rn true;">hodg...@gmail.com</a>&gt; wrote:</div><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><div><font face=3D"arial, h=
elvetica, sans-serif">We already have this:</font></div><div><div style=3D"=
color:rgb(0,0,0);background-color:rgb(255,255,254)"><div><font face=3D"mono=
space, monospace"><span style=3D"color:rgb(0,0,255)">int</span><span style=
=3D"color:rgb(0,0,0)"> main()</span></font></div><div><span style=3D"color:=
rgb(0,0,0)"><font face=3D"monospace, monospace">{</font></span></div><div><=
font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">=C2=A0f=
or_label: </span><span style=3D"color:rgb(0,0,255)">for</span><span style=
=3D"color:rgb(0,0,0)"> (</span><span style=3D"color:rgb(0,0,255)">int</span=
><span style=3D"color:rgb(0,0,0)"> i =3D </span><span style=3D"color:rgb(9,=
136,90)">0</span><span style=3D"color:rgb(0,0,0)"> ; i &lt; </span><span st=
yle=3D"color:rgb(9,136,90)">3</span><span style=3D"color:rgb(0,0,0)"> ; i++=
) {</span></font></div><div><font face=3D"monospace, monospace"><span style=
=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 swit=
ch</span><span style=3D"color:rgb(0,0,0)"> (i) {</span></font></div><div><f=
ont face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><=
span style=3D"color:rgb(0,0,255)">=C2=A0 case</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(9,136,90)">1</span><span style=
=3D"color:rgb(0,0,0)">:</span></font></div><div><font face=3D"monospace, mo=
nospace"><span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0=
,0,255)">=C2=A0 =C2=A0for</span><span style=3D"color:rgb(0,0,0)"> (</span><=
span style=3D"color:rgb(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)=
"> j =3D </span><span style=3D"color:rgb(9,136,90)">0</span><span style=3D"=
color:rgb(0,0,0)"> ; j &lt; </span><span style=3D"color:rgb(9,136,90)">3</s=
pan><span style=3D"color:rgb(0,0,0)"> ; ++j ) {</span></font></div><div><fo=
nt face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><s=
pan style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><span style=3D"colo=
r:rgb(0,0,0)"> (foo(j*i) &gt; </span><span style=3D"color:rgb(9,136,90)">0<=
/span><span style=3D"color:rgb(0,0,0)">) </span><span style=3D"color:rgb(0,=
0,255)">break</span><span style=3D"color:rgb(0,0,0)">; </span><span style=
=3D"color:rgb(0,128,0)">// breaks the innermost loop=C2=A0 =C2=A0</span></f=
ont></div><div><font face=3D"monospace, monospace"><span style=3D"color:rgb=
(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span><=
span style=3D"color:rgb(0,0,0)"> (foo(j*i) &lt; </span><span style=3D"color=
:rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span sty=
le=3D"color:rgb(0,0,255)">goto</span><span style=3D"color:rgb(0,0,0)"> exit=
_switch; </span><span style=3D"color:rgb(0,128,0)">// breaks the switch</sp=
an></font></div><div><font face=3D"monospace, monospace"><span style=3D"col=
or:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</=
span><span style=3D"color:rgb(0,0,0)"> (foo(j*i) =3D=3D </span><span style=
=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span>=
<span style=3D"color:rgb(0,0,255)">goto</span><span style=3D"color:rgb(0,0,=
0)"> exit_for; </span><span style=3D"color:rgb(0,128,0)">// breaks the oute=
rmost loop</span></font></div><div><span style=3D"color:rgb(0,0,0)"><font f=
ace=3D"monospace, monospace">=C2=A0 =C2=A0}</font></span></div><div><span s=
tyle=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=A0 }</fon=
t></span></div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"monospac=
e, monospace">=C2=A0 exit_switch: ;</font></span></div><div><span style=3D"=
color:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=A0}</font></span>=
</div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monosp=
ace">=C2=A0exit_for: ;</font></span></div><div><span style=3D"color:rgb(0,0=
,0)"><font face=3D"monospace, monospace">}</font></span></div></div></div><=
/div></div></blockquote><div><br>The same argument applies to existing <fon=
t face=3D"monospace, monospace">break</font> and <font face=3D"monospace, m=
onospace">continue</font>, and yet C and C++ have them.<br>The point isn&#3=
9;t that we can form arbitrary flows of control using <font face=3D"monospa=
ce, monospace">goto</font>.=C2=A0 The point is that <font face=3D"monospace=
, monospace">break</font><br>and <font face=3D"monospace, monospace">contin=
ue</font> provide meaningful semantics to the reader, namely control flow i=
s either exiting<br>or repeating a block, whereas <font face=3D"monospace, =
monospace">goto</font> has an arbitrary destination.=C2=A0 This concept is =
decades old.<br></div></div></div></blockquote><div><br></div><div>Sure. Bu=
t that has to be balanced against how often you need such things. After all=
, labeled break/continue this is only useful for highly complex code with m=
ultiple nested looping/conditional structures. &quot;It could be done&quot;=
 is not good enough; there has to be some reason why it <i>should</i> be do=
ne.<br></div><div><br></div><div>`goto` is an escape hatch for code structu=
re; when you see one, a red flag lights up to say &quot;odd things are happ=
ening here&quot;.</div><div><br></div><div>Labeled `break`/`continue` don&#=
39;t break structure the way `goto` can. But they don&#39;t represent good,=
 easily digestible structure either. They&#39;re not a full escape hatch th=
e way `goto` is, but they still represent unusual structure of code.</div><=
div><br></div><div>So the question is this: does this unusual structure of =
code happen often enough to justify the addition of a feature to the langua=
ge? And if it is added, will it <i>encourage</i> the creation of code with =
unusual structures?<br></div><div><br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddin=
g-left: 1ex;"><div dir=3D"ltr"><div class=3D"gmail_quote"><div>Additionally=
, as can be seen in your example, the exit labels are placed very awkwardly=
, while<br>the labels for <font face=3D"monospace, monospace">break <i>labe=
l</i>;</font> and <font face=3D"monospace, monospace">continue <i>label</i>=
;</font> clearly denote the blocks addressed.<br>We should place these cons=
tructs into the language and then deprecate uses <i>without</i> labels.</di=
v></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/e0463dbc-befe-4cd7-8744-9fa9f25aa136%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e0463dbc-befe-4cd7-8744-9fa9f25aa136=
%40isocpp.org</a>.<br />

------=_Part_11847_1710964168.1533051464516--

------=_Part_11846_324485050.1533051464516--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Tue, 31 Jul 2018 12:01:19 -0400
Raw View
--000000000000f76cae05724db026
Content-Type: text/plain; charset="UTF-8"

On Tue, Jul 31, 2018 at 11:37 AM Nicol Bolas <jmckesson@gmail.com> wrote:

> So the question is this: does this unusual structure of code happen often
> enough to justify the addition of a feature to the language?
>

The "unusual" structure can be as simple as searching a two-dimensional
array for something:

outer: for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
        if (ok(A[i][j]) {
            do_something();
            break outer;
        }
    }
}

(If this inspires you to show me that you can "just" return from a lambda
instead, please don't.)

--
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/CAHSYqdYxQVHTtP_cTAOXtayEetdNH3GJDGk_Zz4UThRjaNzhjw%40mail.gmail.com.

--000000000000f76cae05724db026
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue, Jul 31=
, 2018 at 11:37 AM Nicol Bolas &lt;<a href=3D"mailto:jmckesson@gmail.com" t=
arget=3D"_blank">jmckesson@gmail.com</a>&gt; wrote:</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><div>So the question is this: does this unus=
ual structure of code happen often enough to justify the addition of a feat=
ure to the language?</div></div></blockquote><div><br>The &quot;unusual&quo=
t; structure can be as simple as searching a two-dimensional array for some=
thing:<br><br><font face=3D"monospace, monospace">outer: for (int i =3D 0; =
i &lt; N;=C2=A0<a class=3D"gmail_plusreply" id=3D"m_5975725598918817033plus=
ReplyChip-1">++i) {</a></font></div><div><font face=3D"monospace, monospace=
"><a class=3D"gmail_plusreply">=C2=A0 =C2=A0 for (int j =3D 0; j &lt; M;=C2=
=A0++j) {</a></font></div><div><a class=3D"gmail_plusreply" style=3D""><fon=
t face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ok(A[i][j])=
 {</font><br><font face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 do_something();</font><br><font face=3D"monospace, monosp=
ace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break outer;</font><br><font=
 face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 }</font><br><fon=
t face=3D"monospace, monospace">=C2=A0 =C2=A0 }</font><br><font face=3D"mon=
ospace, monospace">}</font><br><br><font face=3D"arial, helvetica, sans-ser=
if">(If this inspires you to show me that you can &quot;just&quot; return f=
rom a lambda instead, please don&#39;t.)</font></a></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/CAHSYqdYxQVHTtP_cTAOXtayEetdNH3GJDGk_=
Zz4UThRjaNzhjw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYxQVHTtP_c=
TAOXtayEetdNH3GJDGk_Zz4UThRjaNzhjw%40mail.gmail.com</a>.<br />

--000000000000f76cae05724db026--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 31 Jul 2018 09:48:55 -0700 (PDT)
Raw View
------=_Part_11607_257600610.1533055735241
Content-Type: multipart/alternative;
 boundary="----=_Part_11608_758133996.1533055735241"

------=_Part_11608_758133996.1533055735241
Content-Type: text/plain; charset="UTF-8"

On Tuesday, July 31, 2018 at 12:01:32 PM UTC-4, Hyman Rosen wrote:
>
> On Tue, Jul 31, 2018 at 11:37 AM Nicol Bolas <jmck...@gmail.com
> <javascript:>> wrote:
>
>> So the question is this: does this unusual structure of code happen often
>> enough to justify the addition of a feature to the language?
>>
>
> The "unusual" structure can be as simple as searching a two-dimensional
> array for something:
>
> outer: for (int i = 0; i < N; ++i) {
>     for (int j = 0; j < M; ++j) {
>         if (ok(A[i][j]) {
>             do_something();
>             break outer;
>         }
>     }
> }
>
> (If this inspires you to show me that you can "just" return from a lambda
> instead, please don't.)
>

I *despise* inline lambdas of that sort.

For cases like this, I personally think we'd be better off finding good
ways to make iterators/ranges that can flatten multi-dimensional arrays
(`std::mdspan` being the obvious tool, but I don't think the current
proposal works that way). That way, you can just use `find_if`, and the
code becomes much more readable.

I will say this: I much prefer labeled `break/continue` to any kind of
numbered `break/continue`.

I think the syntax for labeled looping statements (`for`, `while`, etc)
needs to be `keyword <label>:`, rather than `<label>: keyword`. The reason
being that the latter already has a meaning: a label for `goto`. You
shouldn't be able to `goto` a labeled loop, and you shouldn't be able to
`break/continue` to a `goto` label.

--
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/95f8d504-9b11-4912-96f6-41e491731acf%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, July 31, 2018 at 12:01:32 PM UTC-4, Hyman Rose=
n 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 =
class=3D"gmail_quote"><div dir=3D"ltr">On Tue, Jul 31, 2018 at 11:37 AM Nic=
ol Bolas &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailt=
o=3D"WHjRMTBXEQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascr=
ipt:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return=
 true;">jmck...@gmail.com</a>&gt; wrote:</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
"><div dir=3D"ltr"><div>So the question is this: does this unusual structur=
e of code happen often enough to justify the addition of a feature to the l=
anguage?</div></div></blockquote><div><br>The &quot;unusual&quot; structure=
 can be as simple as searching a two-dimensional array for something:<br><b=
r><font face=3D"monospace, monospace">outer: for (int i =3D 0; i &lt; N;=C2=
=A0<a>++i) {</a></font></div><div><font face=3D"monospace, monospace"><a>=
=C2=A0 =C2=A0 for (int j =3D 0; j &lt; M;=C2=A0++j) {</a></font></div><div>=
<a><font face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ok(A=
[i][j]) {</font><br><font face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 do_something();</font><br><font face=3D"monospace,=
 monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break outer;</font><b=
r><font face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 }</font><=
br><font face=3D"monospace, monospace">=C2=A0 =C2=A0 }</font><br><font face=
=3D"monospace, monospace">}</font><br><br><font face=3D"arial, helvetica, s=
ans-serif">(If this inspires you to show me that you can &quot;just&quot; r=
eturn from a lambda instead, please don&#39;t.)</font></a></div></div></div=
></blockquote><div><br></div><div>I <i>despise</i> inline lambdas of that s=
ort.</div><div><br></div><div>For cases like this, I personally think we&#3=
9;d be better off finding good ways to make iterators/ranges that can flatt=
en multi-dimensional arrays (`std::mdspan` being the obvious tool, but I do=
n&#39;t think the current proposal works that way). That way, you can just =
use `find_if`, and the code becomes much more readable.</div><div><br></div=
><div>I will say this: I much prefer labeled `break/continue` to any kind o=
f numbered `break/continue`.</div><div><br></div><div>I think the syntax fo=
r labeled looping statements (`for`, `while`, etc) needs to be `keyword &lt=
;label&gt;:`, rather than `&lt;label&gt;: keyword`. The reason being that t=
he latter already has a meaning: a label for `goto`. You shouldn&#39;t be a=
ble to `goto` a labeled loop, and you shouldn&#39;t be able to `break/conti=
nue` to a `goto` label.<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/95f8d504-9b11-4912-96f6-41e491731acf%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/95f8d504-9b11-4912-96f6-41e491731acf=
%40isocpp.org</a>.<br />

------=_Part_11608_758133996.1533055735241--

------=_Part_11607_257600610.1533055735241--

.


Author: Richard Hodges <hodges.r@gmail.com>
Date: Tue, 31 Jul 2018 23:13:52 +0200
Raw View
--000000000000bf5eb20572520e52
Content-Type: text/plain; charset="UTF-8"

On Tue, 31 Jul 2018 at 17:37, Nicol Bolas <jmckesson@gmail.com> wrote:

> On Tuesday, July 31, 2018 at 10:54:46 AM UTC-4, Hyman Rosen wrote:
>>
>> On Tue, Jul 31, 2018 at 8:55 AM Richard Hodges <hodg...@gmail.com> wrote:
>>
>>> We already have this:
>>> int main()
>>> {
>>>  for_label: for (int i = 0 ; i < 3 ; i++) {
>>>   switch (i) {
>>>   case 1:
>>>    for (int j = 0 ; j < 3 ; ++j ) {
>>>     if (foo(j*i) > 0) break; // breaks the innermost loop
>>>     if (foo(j*i) < 0) goto exit_switch; // breaks the switch
>>>     if (foo(j*i) == 0) goto exit_for; // breaks the outermost loop
>>>    }
>>>   }
>>>   exit_switch: ;
>>>  }
>>>  exit_for: ;
>>> }
>>>
>>
>> The same argument applies to existing break and continue, and yet C and
>> C++ have them.
>> The point isn't that we can form arbitrary flows of control using goto.
>> The point is that break
>> and continue provide meaningful semantics to the reader, namely control
>> flow is either exiting
>> or repeating a block, whereas goto has an arbitrary destination.  This
>> concept is decades old.
>>
>
> Sure. But that has to be balanced against how often you need such things.
> After all, labeled break/continue this is only useful for highly complex
> code with multiple nested looping/conditional structures. "It could be
> done" is not good enough; there has to be some reason why it *should* be
> done.
>
> `goto` is an escape hatch for code structure; when you see one, a red flag
> lights up to say "odd things are happening here".
>

It's interesting to me that you think that. I have always found goto to be
perfectly logical and readable, with the advantage that it does not involve
convoluted ways of avoiding actually saying that you want the flow of
control moved from *here* to *there*.

Most 'structured' nested code loops end up with ridiculous superfluous
'done' flags or multiple repeated tests. Frankly this just makes code
unreadable and illogical.

In the end the processor is going to do a conditional branch. Why not just
express that in code and be done with it?

break foo; is just a way of writing goto without using the keyword goto,
because you know, the goto boogeyman.



>
> Labeled `break`/`continue` don't break structure the way `goto` can. But
> they don't represent good, easily digestible structure either. They're not
> a full escape hatch the way `goto` is, but they still represent unusual
> structure of code.
>
> So the question is this: does this unusual structure of code happen often
> enough to justify the addition of a feature to the language? And if it is
> added, will it *encourage* the creation of code with unusual structures?
>
> Additionally, as can be seen in your example, the exit labels are placed
>> very awkwardly, while
>> the labels for break *label*; and continue *label*; clearly denote the
>> blocks addressed.
>> We should place these constructs into the language and then deprecate
>> uses *without* labels.
>>
> --
> 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/e0463dbc-befe-4cd7-8744-9fa9f25aa136%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e0463dbc-befe-4cd7-8744-9fa9f25aa136%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

--
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/CALvx3haoc%3DVAvhUNDv7XD7yvewqXUxwTBJkXViqxHOL1ipTYKQ%40mail.gmail.com.

--000000000000bf5eb20572520e52
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue=
, 31 Jul 2018 at 17:37, Nicol Bolas &lt;<a href=3D"mailto:jmckesson@gmail.c=
om">jmckesson@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr">On Tuesday, July 31, 2018 at 10:54:46 AM UTC-4, Hyman =
Rosen 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 c=
lass=3D"gmail_quote"><div dir=3D"ltr">On Tue, Jul 31, 2018 at 8:55 AM Richa=
rd Hodges &lt;<a rel=3D"nofollow">hodg...@gmail.com</a>&gt; wrote:</div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><di=
v><font face=3D"arial, helvetica, sans-serif">We already have this:</font><=
/div><div><div style=3D"color:rgb(0,0,0);background-color:rgb(255,255,254)"=
><div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,255)=
">int</span><span style=3D"color:rgb(0,0,0)"> main()</span></font></div><di=
v><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">{</f=
ont></span></div><div><font face=3D"monospace, monospace"><span style=3D"co=
lor:rgb(0,0,0)">=C2=A0for_label: </span><span style=3D"color:rgb(0,0,255)">=
for</span><span style=3D"color:rgb(0,0,0)"> (</span><span style=3D"color:rg=
b(0,0,255)">int</span><span style=3D"color:rgb(0,0,0)"> i =3D </span><span =
style=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)"> ; i=
 &lt; </span><span style=3D"color:rgb(9,136,90)">3</span><span style=3D"col=
or:rgb(0,0,0)"> ; i++) {</span></font></div><div><font face=3D"monospace, m=
onospace"><span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(=
0,0,255)">=C2=A0 switch</span><span style=3D"color:rgb(0,0,0)"> (i) {</span=
></font></div><div><font face=3D"monospace, monospace"><span style=3D"color=
:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 case</span><s=
pan style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(9,136,90)">=
1</span><span style=3D"color:rgb(0,0,0)">:</span></font></div><div><font fa=
ce=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span><span s=
tyle=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0for</span><span style=3D"color:rgb=
(0,0,0)"> (</span><span style=3D"color:rgb(0,0,255)">int</span><span style=
=3D"color:rgb(0,0,0)"> j =3D </span><span style=3D"color:rgb(9,136,90)">0</=
span><span style=3D"color:rgb(0,0,0)"> ; j &lt; </span><span style=3D"color=
:rgb(9,136,90)">3</span><span style=3D"color:rgb(0,0,0)"> ; ++j ) {</span><=
/font></div><div><font face=3D"monospace, monospace"><span style=3D"color:r=
gb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=A0 =C2=A0 if</span=
><span style=3D"color:rgb(0,0,0)"> (foo(j*i) &gt; </span><span style=3D"col=
or:rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0)">) </span><span s=
tyle=3D"color:rgb(0,0,255)">break</span><span style=3D"color:rgb(0,0,0)">; =
</span><span style=3D"color:rgb(0,128,0)">// breaks the innermost loop=C2=
=A0 =C2=A0</span></font></div><div><font face=3D"monospace, monospace"><spa=
n style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255)">=C2=
=A0 =C2=A0 if</span><span style=3D"color:rgb(0,0,0)"> (foo(j*i) &lt; </span=
><span style=3D"color:rgb(9,136,90)">0</span><span style=3D"color:rgb(0,0,0=
)">) </span><span style=3D"color:rgb(0,0,255)">goto</span><span style=3D"co=
lor:rgb(0,0,0)"> exit_switch; </span><span style=3D"color:rgb(0,128,0)">// =
breaks the switch</span></font></div><div><font face=3D"monospace, monospac=
e"><span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,255=
)">=C2=A0 =C2=A0 if</span><span style=3D"color:rgb(0,0,0)"> (foo(j*i) =3D=
=3D </span><span style=3D"color:rgb(9,136,90)">0</span><span style=3D"color=
:rgb(0,0,0)">) </span><span style=3D"color:rgb(0,0,255)">goto</span><span s=
tyle=3D"color:rgb(0,0,0)"> exit_for; </span><span style=3D"color:rgb(0,128,=
0)">// breaks the outermost loop</span></font></div><div><span style=3D"col=
or:rgb(0,0,0)"><font face=3D"monospace, monospace">=C2=A0 =C2=A0}</font></s=
pan></div><div><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, mo=
nospace">=C2=A0 }</font></span></div><div><span style=3D"color:rgb(0,0,0)">=
<font face=3D"monospace, monospace">=C2=A0 exit_switch: ;</font></span></di=
v><div><span style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace"=
>=C2=A0}</font></span></div><div><span style=3D"color:rgb(0,0,0)"><font fac=
e=3D"monospace, monospace">=C2=A0exit_for: ;</font></span></div><div><span =
style=3D"color:rgb(0,0,0)"><font face=3D"monospace, monospace">}</font></sp=
an></div></div></div></div></div></blockquote><div><br>The same argument ap=
plies to existing <font face=3D"monospace, monospace">break</font> and <fon=
t face=3D"monospace, monospace">continue</font>, and yet C and C++ have the=
m.<br>The point isn&#39;t that we can form arbitrary flows of control using=
 <font face=3D"monospace, monospace">goto</font>.=C2=A0 The point is that <=
font face=3D"monospace, monospace">break</font><br>and <font face=3D"monosp=
ace, monospace">continue</font> provide meaningful semantics to the reader,=
 namely control flow is either exiting<br>or repeating a block, whereas <fo=
nt face=3D"monospace, monospace">goto</font> has an arbitrary destination.=
=C2=A0 This concept is decades old.<br></div></div></div></blockquote><div>=
<br></div><div>Sure. But that has to be balanced against how often you need=
 such things. After all, labeled break/continue this is only useful for hig=
hly complex code with multiple nested looping/conditional structures. &quot=
;It could be done&quot; is not good enough; there has to be some reason why=
 it <i>should</i> be done.<br></div><div><br></div><div>`goto` is an escape=
 hatch for code structure; when you see one, a red flag lights up to say &q=
uot;odd things are happening here&quot;.</div></div></blockquote><div><br><=
/div><div>It&#39;s interesting to me that you think that. I have always fou=
nd <font face=3D"monospace, monospace">goto</font> to be perfectly logical =
and readable, with the advantage that it does not involve convoluted ways o=
f avoiding actually saying that you want the flow of control moved from <i>=
here</i> to <i>there</i>.</div><div><br></div><div>Most &#39;structured&#39=
; nested code loops end up with ridiculous superfluous &#39;done&#39; flags=
 or multiple repeated tests. Frankly this just makes code unreadable and il=
logical.</div><div><br></div><div>In the end the processor is going to do a=
 conditional branch. Why not just express that in code and be done with it?=
</div><div><br></div><div><font face=3D"monospace, monospace">break foo;</f=
ont> is just a way of writing <font face=3D"monospace, monospace">goto</fon=
t> without using the keyword <font face=3D"monospace, monospace">goto</font=
>, because you know, the <font face=3D"monospace, monospace">goto</font> bo=
ogeyman.</div><div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
"><div dir=3D"ltr"><div><br></div><div>Labeled `break`/`continue` don&#39;t=
 break structure the way `goto` can. But they don&#39;t represent good, eas=
ily digestible structure either. They&#39;re not a full escape hatch the wa=
y `goto` is, but they still represent unusual structure of code.</div><div>=
<br></div><div>So the question is this: does this unusual structure of code=
 happen often enough to justify the addition of a feature to the language? =
And if it is added, will it <i>encourage</i> the creation of code with unus=
ual structures?<br></div><div><br></div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><div>Additionally, as can =
be seen in your example, the exit labels are placed very awkwardly, while<b=
r>the labels for <font face=3D"monospace, monospace">break <i>label</i>;</f=
ont> and <font face=3D"monospace, monospace">continue <i>label</i>;</font> =
clearly denote the blocks addressed.<br>We should place these constructs in=
to the language and then deprecate uses <i>without</i> labels.</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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/e0463dbc-befe-4cd7-8744-9fa9f25aa136%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e0463dbc-befe-=
4cd7-8744-9fa9f25aa136%40isocpp.org</a>.<br>
</blockquote></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/CALvx3haoc%3DVAvhUNDv7XD7yvewqXUxwTBJ=
kXViqxHOL1ipTYKQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3haoc%3DVA=
vhUNDv7XD7yvewqXUxwTBJkXViqxHOL1ipTYKQ%40mail.gmail.com</a>.<br />

--000000000000bf5eb20572520e52--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Tue, 31 Jul 2018 17:30:15 -0400
Raw View
--0000000000005dac5c0572524975
Content-Type: text/plain; charset="UTF-8"

On Tue, Jul 31, 2018 at 5:14 PM Richard Hodges <hodges.r@gmail.com> wrote:

> break foo; is just a way of writing goto without using the keyword goto,
> because you know, the goto boogeyman.
>

That's not true.  When you say *break label;* the label is situated at the
loop being exited.  When you say *goto label;* the label decorates an empty
semicolon far away from the business end of the loop iteration code.  The
proof that this is the right way to do it is that it's part of Ada :-)

Proposing a different label form as a target for labeled break and continue
is just an additional way to derail the idea.

--
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/CAHSYqdZEgyrqv7O3JwGv5FKTJiRnY%2BOJZSnJ5OaQfEgWjiWRjQ%40mail.gmail.com.

--0000000000005dac5c0572524975
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue, Jul 31=
, 2018 at 5:14 PM Richard Hodges &lt;<a href=3D"mailto:hodges.r@gmail.com">=
hodges.r@gmail.com</a>&gt; wrote:</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr"><div class=3D"gmail_quote"><div><font face=3D"monospace, monosp=
ace">break foo;</font> is just a way of writing <font face=3D"monospace, mo=
nospace">goto</font> without using the keyword <font face=3D"monospace, mon=
ospace">goto</font>, because you know, the <font face=3D"monospace, monospa=
ce">goto</font> boogeyman.</div></div></div></blockquote><div><br>That&#39;=
s not true.=C2=A0 When you say <font face=3D"monospace, monospace"><b>break=
 label;</b></font> the label is situated at the loop being exited.=C2=A0 Wh=
en you say <font face=3D"monospace, monospace"><b>goto label;</b></font> th=
e label decorates an empty semicolon far away from the business end of the =
loop iteration code.=C2=A0 The proof that this is the right way to do it is=
 that it&#39;s part of Ada :-)<br><br>Proposing a different label form as a=
 target for labeled break and continue is just an additional way to derail =
the idea.</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/CAHSYqdZEgyrqv7O3JwGv5FKTJiRnY%2BOJZS=
nJ5OaQfEgWjiWRjQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdZEgyrqv7=
O3JwGv5FKTJiRnY%2BOJZSnJ5OaQfEgWjiWRjQ%40mail.gmail.com</a>.<br />

--0000000000005dac5c0572524975--

.


Author: Richard Hodges <hodges.r@gmail.com>
Date: Wed, 1 Aug 2018 10:47:21 +0200
Raw View
--000000000000d9ba3c05725bbea3
Content-Type: text/plain; charset="UTF-8"

On Tue, 31 Jul 2018 at 23:30, Hyman Rosen <hyman.rosen@gmail.com> wrote:

> On Tue, Jul 31, 2018 at 5:14 PM Richard Hodges <hodges.r@gmail.com> wrote:
>
>> break foo; is just a way of writing goto without using the keyword goto,
>> because you know, the goto boogeyman.
>>
>
> That's not true.  When you say *break label;* the label is situated at
> the loop being exited.
>

And if you are reading the code, you'd have to backward-search for the
labelled loop and then start counting forward open-close curly brace pairs
to find the exit point. i.e. not readable


> When you say *goto label;* the label decorates an empty semicolon far
> away from the business end of the loop iteration code.
>

when reading this code you simply *:/label* or *ctrl-f label* and bob's
you're uncle - you found it


> The proof that this is the right way to do it is that it's part of Ada :-)
>

Ada is extinct ! :)


>
> Proposing a different label form as a target for labeled break and
> continue is just an additional way to derail the idea.
>

I principle I agree with the idea - we should be teaching the active use of
the unfairly maligned goto.


> --
> 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/CAHSYqdZEgyrqv7O3JwGv5FKTJiRnY%2BOJZSnJ5OaQfEgWjiWRjQ%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdZEgyrqv7O3JwGv5FKTJiRnY%2BOJZSnJ5OaQfEgWjiWRjQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

--
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/CALvx3hZ4Uis%3DaZADnxvp2DJf_Ku_JXSmxcdYzU4Jj7FTVOOcHQ%40mail.gmail.com.

--000000000000d9ba3c05725bbea3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue=
, 31 Jul 2018 at 23:30, Hyman Rosen &lt;<a href=3D"mailto:hyman.rosen@gmail=
..com">hyman.rosen@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue=
, Jul 31, 2018 at 5:14 PM Richard Hodges &lt;<a href=3D"mailto:hodges.r@gma=
il.com" target=3D"_blank">hodges.r@gmail.com</a>&gt; wrote:</div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><div><font=
 face=3D"monospace, monospace">break foo;</font> is just a way of writing <=
font face=3D"monospace, monospace">goto</font> without using the keyword <f=
ont face=3D"monospace, monospace">goto</font>, because you know, the <font =
face=3D"monospace, monospace">goto</font> boogeyman.</div></div></div></blo=
ckquote><div><br>That&#39;s not true.=C2=A0 When you say <font face=3D"mono=
space, monospace"><b>break label;</b></font> the label is situated at the l=
oop being exited.=C2=A0 </div></div></div></blockquote><div><br></div><div>=
And if you are reading the code, you&#39;d have to backward-search for the =
labelled loop and then start counting forward open-close curly brace pairs =
to find the exit point. i.e. not readable</div><div>=C2=A0</div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><div>When y=
ou say <font face=3D"monospace, monospace"><b>goto label;</b></font> the la=
bel decorates an empty semicolon far away from the business end of the loop=
 iteration code.=C2=A0 </div></div></div></blockquote><div><br></div><div>w=
hen reading this code you simply <b><font face=3D"monospace, monospace">:/l=
abel</font></b> or <b><font face=3D"monospace, monospace">ctrl-f label</fon=
t></b> and bob&#39;s you&#39;re uncle - you found it</div><div>=C2=A0</div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote">=
<div>The proof that this is the right way to do it is that it&#39;s part of=
 Ada :-)<br></div></div></div></blockquote><div><br></div><div>Ada is extin=
ct ! :)</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"lt=
r"><div class=3D"gmail_quote"><div><br>Proposing a different label form as =
a target for labeled break and continue is just an additional way to derail=
 the idea.</div></div></div></blockquote><div><br></div><div>I principle I =
agree with the idea - we should be teaching the active use of the unfairly =
maligned <font face=3D"monospace, monospace">goto</font>.</div><div>=C2=A0<=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">

<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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/CAHSYqdZEgyrqv7O3JwGv5FKTJiRnY%2BOJZS=
nJ5OaQfEgWjiWRjQ%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoote=
r" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-pro=
posals/CAHSYqdZEgyrqv7O3JwGv5FKTJiRnY%2BOJZSnJ5OaQfEgWjiWRjQ%40mail.gmail.c=
om</a>.<br>
</blockquote></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/CALvx3hZ4Uis%3DaZADnxvp2DJf_Ku_JXSmxc=
dYzU4Jj7FTVOOcHQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hZ4Uis%3D=
aZADnxvp2DJf_Ku_JXSmxcdYzU4Jj7FTVOOcHQ%40mail.gmail.com</a>.<br />

--000000000000d9ba3c05725bbea3--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Wed, 1 Aug 2018 11:46:13 -0400
Raw View
--000000000000d81acc0572619808
Content-Type: text/plain; charset="UTF-8"

On Wed, Aug 1, 2018 at 4:47 AM Richard Hodges <hodges.r@gmail.com> wrote:

> On Tue, 31 Jul 2018 at 23:30, Hyman Rosen <hyman.rosen@gmail.com> wrote:
> start counting forward open-close curly brace pairs to find the exit
> point. i.e. not readable
>

Program editors can find matching braces with one keystroke.

When you say *goto label;* the label decorates an empty semicolon far away
>> from the business end of the loop iteration code.
>>
>
> when reading this code you simply *:/label* or *ctrl-f label* and bob's
> you're uncle - you found it
>

It's not that it can't be found, it's that it doesn't label anything useful.
You have to go back to the top of the loop anyway to see what's going on.

The proof that this is the right way to do it is that it's part of Ada :-)
>>
>
> Ada is extinct ! :)
>

Far, far from it: <https://www.adacore.com/>.
The standard, ISO/IEC 8652:2012(E) , was last revised in 2012: <
http://www.ada-auth.org/standards/12rm/html/RM-TTL.html>

--
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/CAHSYqdaNg7C2tv8zMyexyRMfNAYirb6CzoV0cKZFiF3gxk2i7Q%40mail.gmail.com.

--000000000000d81acc0572619808
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Wed, Aug 1,=
 2018 at 4:47 AM Richard Hodges &lt;<a href=3D"mailto:hodges.r@gmail.com">h=
odges.r@gmail.com</a>&gt; wrote:</div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddi=
ng-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">O=
n Tue, 31 Jul 2018 at 23:30, Hyman Rosen &lt;<a href=3D"mailto:hyman.rosen@=
gmail.com" target=3D"_blank">hyman.rosen@gmail.com</a>&gt; wrote:</div><div=
>start counting forward open-close curly brace pairs to find the exit point=
.. i.e. not readable</div></div></div></blockquote><div><br>Program editors =
can find matching braces with one keystroke.<br><br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote=
"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde=
r-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div c=
lass=3D"gmail_quote"><div>When you say <font face=3D"monospace, monospace">=
<b>goto label;</b></font> the label decorates an empty semicolon far away f=
rom the business end of the loop iteration code.=C2=A0 </div></div></div></=
blockquote><div><br></div><div>when reading this code you simply <b><font f=
ace=3D"monospace, monospace">:/label</font></b> or <b><font face=3D"monospa=
ce, monospace">ctrl-f label</font></b> and bob&#39;s you&#39;re uncle - you=
 found it</div></div></div></blockquote><div><br>It&#39;s not that it can&#=
39;t be found, it&#39;s that it doesn&#39;t label anything useful.<br>You h=
ave to go back to the top of the loop anyway to see what&#39;s going on.<br=
><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"lt=
r"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:=
1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><div>The proof that this i=
s the right way to do it is that it&#39;s part of Ada :-)<br></div></div></=
div></blockquote><div><br></div><div>Ada is extinct ! :)</div></div></div><=
/blockquote><div><br>Far, far from it: &lt;<a href=3D"https://www.adacore.c=
om/">https://www.adacore.com/</a>&gt;.<br>The standard, ISO/IEC 8652:2012(E=
) , was=C2=A0last revised in 2012: &lt;<a href=3D"http://www.ada-auth.org/s=
tandards/12rm/html/RM-TTL.html">http://www.ada-auth.org/standards/12rm/html=
/RM-TTL.html</a>&gt;</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/CAHSYqdaNg7C2tv8zMyexyRMfNAYirb6CzoV0=
cKZFiF3gxk2i7Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdaNg7C2tv8z=
MyexyRMfNAYirb6CzoV0cKZFiF3gxk2i7Q%40mail.gmail.com</a>.<br />

--000000000000d81acc0572619808--

.