Topic: Have you ever considered break( n ) ?


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 04:54:14 -0700 (PDT)
Raw View
------=_Part_2030_1417929065.1473335654580
Content-Type: multipart/alternative;
 boundary="----=_Part_2031_698811093.1473335654581"

------=_Part_2031_698811093.1473335654581
Content-Type: text/plain; charset=UTF-8

    In order to exit from a nested loop when a condition is found you need
to add an extra condition to ckeck in each external loop:


    while ( cond1 )
    {
        bool found = false;
        while ( cond2 )
        {
            if ( cond3 )
            {
                found = true;
                *break;*
            }
        }

        if ( found )
        {
            *break;*
        }
    }


    *solution 1 ) *elegant but slow to code: declare a new method, move
that double bucle to that method and use return


    void    test()
    {
        while ( cond1 )
        {
            while ( cond2 )
            {
                if ( cond3 )
                {
*                    return*;
                }
            }
        }
    }

 *   solution 2 *) use goto ( faster to code but uglier style )


https://msdn.microsoft.com/en-us/library/b34dt9cd.aspx?f=255&MSPPError=-2147217396

    "It is good programming style to use the break, continue, and return
statements instead of the goto statement whenever possible. However,
because the break statement exits from only one level of a loop, you might
have to use a goto statement to exit a deeply nested loop."

    while ( cond1 )
    {
        while ( cond2 )
        {
            if ( cond3 )
            {
                *goto LabelEndLoops;*
            }
        }
    }

*    LabelEndLoops;*


    *solution 3 )* proposal... break( n )

    while ( cond1 )
    {
        while ( cond2 )
        {
            if ( cond3 )
            {
               * break( 2 ); *
            }
        }
    }

    This is very simple to solve by compiler, it just needs to replace
internally by a goto statement.

        *break( 1 )* = *break*  exits from 1 loop
        *break( n )* exits from n loops
        *break( * )* exits from all loops

    or if you prefer break1, breakN, break* without the parenthesis instead
is also acceptable.
    ( In case of symbol * cannot be used, it can be replaced by any more
convenient. )

--
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/dd17ca27-52ab-4999-be17-87bac1bc55da%40isocpp.org.

------=_Part_2031_698811093.1473335654581
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: base64

PGRpdiBkaXI9Imx0ciI+wqDCoMKgIEluIG9yZGVyIHRvIGV4aXQgZnJvbSBhIG5lc3RlZCBsb29w
IHdoZW4gYSBjb25kaXRpb24gaXMgZm91bmQgeW91IG5lZWQgdG8gYWRkIGFuIGV4dHJhIGNvbmRp
dGlvbiB0byBja2VjayBpbiBlYWNoIGV4dGVybmFsIGxvb3A6PGJyPjxicj48YnI+wqDCoMKgIHdo
aWxlICggY29uZDEgKTxicj7CoMKgwqAgezxicj7CoMKgwqAgwqDCoMKgIGJvb2wgZm91bmQgPSBm
YWxzZTs8YnI+wqDCoMKgIMKgwqDCoCB3aGlsZSAoIGNvbmQyICk8YnI+wqDCoMKgIMKgwqDCoCB7
PGJyPsKgwqDCoCDCoMKgwqAgwqDCoMKgIGlmICggY29uZDMgKTxicj7CoMKgwqAgwqDCoMKgIMKg
wqDCoCB7PGJyPsKgwqDCoCDCoMKgwqAgwqDCoMKgIMKgwqDCoCBmb3VuZCA9IHRydWU7PGJyPsKg
wqDCoCDCoMKgwqAgwqDCoMKgIMKgwqDCoCA8c3BhbiBzdHlsZT0iY29sb3I6IHJnYigyNTUsIDAs
IDApOyI+PGI+YnJlYWs7PC9iPjwvc3Bhbj48YnI+wqDCoMKgIMKgwqDCoCDCoMKgwqAgfTxicj7C
oMKgwqAgwqDCoMKgIH08YnI+PGJyPsKgwqDCoCDCoMKgwqAgaWYgKCBmb3VuZCApPGJyPsKgwqDC
oMKgwqDCoMKgIHsgPGJyPsKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgPGI+PHNwYW4gc3R5bGU9ImNv
bG9yOiByZ2IoMjU1LCAwLCAwKTsiPmJyZWFrOzwvc3Bhbj48L2I+PGJyPsKgwqDCoMKgwqDCoMKg
IH3CoMKgIDxicj7CoMKgwqAgfTxicj48YnI+PGJyPsKgwqDCoCA8Yj5zb2x1dGlvbiAxICkgPC9i
PmVsZWdhbnQgYnV0IHNsb3cgdG8gY29kZTogZGVjbGFyZSBhIG5ldyBtZXRob2QsIG1vdmUgdGhh
dCBkb3VibGUgYnVjbGUgdG8gdGhhdCBtZXRob2QgYW5kIHVzZSByZXR1cm48YnI+wqDCoMKgIDxi
cj48YnI+wqDCoMKgIHZvaWTCoMKgwqAgdGVzdCgpPGJyPsKgwqDCoCB7PGJyPsKgwqDCoCDCoMKg
wqAgd2hpbGUgKCBjb25kMSApPGJyPsKgwqDCoCDCoMKgwqAgezxicj7CoMKgwqAgwqDCoMKgIMKg
wqDCoCB3aGlsZSAoIGNvbmQyICk8YnI+wqDCoMKgIMKgwqDCoCDCoMKgwqAgezxicj7CoMKgwqAg
wqDCoMKgIMKgwqDCoCDCoMKgwqAgaWYgKCBjb25kMyApPHNwYW4gc3R5bGU9ImNvbG9yOiByZ2Io
MjU1LCAwLCAwKTsiPjxiPjxicj48L2I+PHNwYW4gc3R5bGU9ImNvbG9yOiByZ2IoNjgsIDY4LCA2
OCk7Ij7CoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB7PC9zcGFuPjxiPjxicj7CoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCByZXR1cm48L2I+PC9zcGFuPjvCoMKgwqAgwqDCoMKgIMKgwqDCoCDC
oMKgwqAgPGJyPsKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCB9PGJyPsKgwqDCoCDCoMKg
wqAgwqDCoMKgIH3CoMKgwqAgwqDCoMKgIMKgwqDCoCA8YnI+wqDCoMKgIMKgwqDCoCB9PGJyPsKg
wqDCoCB9PGJyPjxicj7CoDxiPsKgwqAgc29sdXRpb24gMiA8L2I+KSB1c2UgPHNwYW4gc3R5bGU9
ImNvbG9yOiByZ2IoMjU1LCAwLCAwKTsiPmdvdG88L3NwYW4+ICggZmFzdGVyIHRvIGNvZGUgYnV0
IHVnbGllciBzdHlsZSApPGJyPsKgwqDCoCA8YnI+wqDCoMKgIGh0dHBzOi8vbXNkbi5taWNyb3Nv
ZnQuY29tL2VuLXVzL2xpYnJhcnkvYjM0ZHQ5Y2QuYXNweD9mPTI1NSZhbXA7TVNQUEVycm9yPS0y
MTQ3MjE3Mzk2PGJyPjxicj7CoMKgwqAgJnF1b3Q7SXQgaXMgZ29vZCBwcm9ncmFtbWluZyBzdHls
ZSB0byB1c2UgdGhlIGJyZWFrLCBjb250aW51ZSwgYW5kIHJldHVybiBzdGF0ZW1lbnRzIGluc3Rl
YWQgb2YgdGhlIGdvdG8gc3RhdGVtZW50IHdoZW5ldmVyIHBvc3NpYmxlLiBIb3dldmVyLCBiZWNh
dXNlIHRoZSBicmVhayBzdGF0ZW1lbnQgZXhpdHMgZnJvbSBvbmx5IG9uZSBsZXZlbCBvZiBhIGxv
b3AsIHlvdSBtaWdodCBoYXZlIHRvIHVzZSBhIGdvdG8gc3RhdGVtZW50IHRvIGV4aXQgYSBkZWVw
bHkgbmVzdGVkIGxvb3AuJnF1b3Q7PGJyPjxicj7CoMKgwqAgd2hpbGUgKCBjb25kMSApPGJyPsKg
wqDCoCB7PGJyPsKgwqDCoCDCoMKgwqAgd2hpbGUgKCBjb25kMiApPGJyPsKgwqDCoCDCoMKgwqAg
ezxicj7CoMKgwqAgwqDCoMKgIMKgwqDCoCBpZiAoIGNvbmQzICk8YnI+wqDCoMKgIMKgwqDCoCDC
oMKgwqAge8KgwqDCoCDCoMKgwqDCoCA8YnI+wqDCoMKgIMKgwqDCoCDCoMKgwqAgwqDCoMKgIDxz
cGFuIHN0eWxlPSJjb2xvcjogcmdiKDI1NSwgMCwgMCk7Ij48Yj5nb3RvIExhYmVsRW5kTG9vcHM7
PC9iPjwvc3Bhbj48YnI+wqDCoMKgIMKgwqDCoCDCoMKgwqAgfTxicj7CoMKgwqAgwqDCoMKgIH08
Yj48c3BhbiBzdHlsZT0iY29sb3I6IHJnYigyNTUsIDAsIDApOyI+PC9zcGFuPjwvYj48YnI+wqDC
oMKgIH08YnI+PGJyPjxzcGFuIHN0eWxlPSJjb2xvcjogcmdiKDI1NSwgMCwgMCk7Ij48Yj7CoMKg
wqAgTGFiZWxFbmRMb29wczs8L2I+PC9zcGFuPjxicj48YnI+PGJyPsKgwqDCoDxiPiA8L2I+PHNw
YW4gc3R5bGU9ImNvbG9yOiByZ2IoMCwgMCwgMCk7Ij48Yj5zb2x1dGlvbiAzICk8L2I+IDwvc3Bh
bj5wcm9wb3NhbC4uLjxzcGFuIHN0eWxlPSJjb2xvcjogcmdiKDI1NSwgMCwgMCk7Ij4gYnJlYWso
IG4gKTwvc3Bhbj48YnI+PGJyPsKgwqDCoCB3aGlsZSAoIGNvbmQxICk8YnI+wqDCoMKgIHvCoMKg
wqAgwqDCoMKgIDxicj7CoMKgwqAgwqDCoMKgIHdoaWxlICggY29uZDIgKTxicj7CoMKgwqAgwqDC
oMKgIHs8YnI+wqDCoMKgIMKgwqDCoCDCoMKgwqAgaWYgKCBjb25kMyApPGJyPsKgwqDCoCDCoMKg
wqAgwqDCoMKgIHs8YnI+wqDCoMKgIMKgwqDCoCDCoMKgwqAgwqDCoMKgPGI+PHNwYW4gc3R5bGU9
ImNvbG9yOiByZ2IoMjU1LCAwLCAwKTsiPiBicmVhayggMiApOyA8L3NwYW4+PC9iPjxicj7CoMKg
wqAgwqDCoMKgIMKgwqDCoCB9PGJyPsKgwqDCoCDCoMKgwqAgfTxicj7CoMKgwqAgfTxicj48YnI+
wqDCoMKgIFRoaXMgaXMgdmVyeSBzaW1wbGUgdG8gc29sdmUgYnkgY29tcGlsZXIsIGl0IGp1c3Qg
bmVlZHMgdG8gcmVwbGFjZSBpbnRlcm5hbGx5IGJ5IGEgZ290byBzdGF0ZW1lbnQuPGJyPjxicj7C
oMKgwqAgwqDCoMKgIDxiPmJyZWFrKCAxICk8L2I+ID0gPGI+YnJlYWs8L2I+wqAgZXhpdHMgZnJv
bSAxIGxvb3A8YnI+wqDCoMKgIMKgwqDCoCA8Yj5icmVhayggbiApPC9iPiBleGl0cyBmcm9tIG4g
bG9vcHM8YnI+wqDCoMKgIMKgwqDCoCA8Yj5icmVhayggKiApPC9iPiBleGl0cyBmcm9tIGFsbCBs
b29wczxicj48YnI+wqDCoMKgIG9yIGlmIHlvdSBwcmVmZXIgYnJlYWsxLCBicmVha04sIGJyZWFr
KiB3aXRob3V0IHRoZSBwYXJlbnRoZXNpcyBpbnN0ZWFkIGlzIGFsc28gYWNjZXB0YWJsZS48YnI+
wqDCoMKgICggSW4gY2FzZSBvZiBzeW1ib2wgKiBjYW5ub3QgYmUgdXNlZCwgaXQgY2FuIGJlIHJl
cGxhY2VkIGJ5IGFueSBtb3JlIGNvbnZlbmllbnQuICk8YnI+PC9kaXY+DQoNCjxwPjwvcD4KCi0t
IDxiciAvPgpZb3UgcmVjZWl2ZWQgdGhpcyBtZXNzYWdlIGJlY2F1c2UgeW91IGFyZSBzdWJzY3Jp
YmVkIHRvIHRoZSBHb29nbGUgR3JvdXBzICZxdW90O0lTTyBDKysgU3RhbmRhcmQgLSBGdXR1cmUg
UHJvcG9zYWxzJnF1b3Q7IGdyb3VwLjxiciAvPgpUbyB1bnN1YnNjcmliZSBmcm9tIHRoaXMgZ3Jv
dXAgYW5kIHN0b3AgcmVjZWl2aW5nIGVtYWlscyBmcm9tIGl0LCBzZW5kIGFuIGVtYWlsIHRvIDxh
IGhyZWY9Im1haWx0bzpzdGQtcHJvcG9zYWxzK3Vuc3Vic2NyaWJlQGlzb2NwcC5vcmciPnN0ZC1w
cm9wb3NhbHMrdW5zdWJzY3JpYmVAaXNvY3BwLm9yZzwvYT4uPGJyIC8+ClRvIHBvc3QgdG8gdGhp
cyBncm91cCwgc2VuZCBlbWFpbCB0byA8YSBocmVmPSJtYWlsdG86c3RkLXByb3Bvc2Fsc0Bpc29j
cHAub3JnIj5zdGQtcHJvcG9zYWxzQGlzb2NwcC5vcmc8L2E+LjxiciAvPgpUbyB2aWV3IHRoaXMg
ZGlzY3Vzc2lvbiBvbiB0aGUgd2ViIHZpc2l0IDxhIGhyZWY9Imh0dHBzOi8vZ3JvdXBzLmdvb2ds
ZS5jb20vYS9pc29jcHAub3JnL2QvbXNnaWQvc3RkLXByb3Bvc2Fscy9kZDE3Y2EyNy01MmFiLTQ5
OTktYmUxNy04N2JhYzFiYzU1ZGElNDBpc29jcHAub3JnP3V0bV9tZWRpdW09ZW1haWwmdXRtX3Nv
dXJjZT1mb290ZXIiPmh0dHBzOi8vZ3JvdXBzLmdvb2dsZS5jb20vYS9pc29jcHAub3JnL2QvbXNn
aWQvc3RkLXByb3Bvc2Fscy9kZDE3Y2EyNy01MmFiLTQ5OTktYmUxNy04N2JhYzFiYzU1ZGElNDBp
c29jcHAub3JnPC9hPi48YnIgLz4K
------=_Part_2031_698811093.1473335654581--

------=_Part_2030_1417929065.1473335654580--

.


Author: Larry Evans <cppljevans@suddenlink.net>
Date: Thu, 8 Sep 2016 07:10:51 -0500
Raw View
On 09/08/2016 06:54 AM, amgstc@gmail.com wrote:
[snip]
>     "It is good programming style to use the break, continue, and return
> statements instead of the goto statement whenever possible. However,
> because the break statement exits from only one level of a loop, you
> might have to use a goto statement to exit a deeply nested loop."
>
>     while ( cond1 )
>     {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 *goto LabelEndLoops;*
>             }
>         }**
>     }
>
> *    LabelEndLoops;*
>
>
>    ***solution 3 )* proposal...break( n )
>
>     while ( cond1 )
>     {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                *break( 2 ); *
>             }
>         }
>     }
>
>     This is very simple to solve by compiler, it just needs to replace
> internally by a goto statement.
>
>         *break( 1 )* = *break*  exits from 1 loop
>         *break( n )* exits from n loops
>         *break( * )* exits from all loops
>
[snip]

Years ago (1980's or maybe 1970's) there was an article
describing a language with, instead of:

    break(levels_to_exit)

it was

   exit(levels_to_exit)

and I think just a loop keyword.  The article showed how to
transform any goto program to one just using this exit and
loop and if-then-else.

I've tried to find the reference without success.  I'll
continue looking if anyone's interested.

-regards,
Larry


--
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/nqrkga%24hgr%241%40blaine.gmane.org.

.


Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Thu, 8 Sep 2016 14:16:02 +0200
Raw View
--001a11401fba528e2d053bfdfee3
Content-Type: text/plain; charset=UTF-8

It was considered I think at least 2 times in very long threads in the last
2 years in this very discussion group.
You should be able to find it by searching "break" with another keyword.

On 8 September 2016 at 14:10, Larry Evans <cppljevans@suddenlink.net> wrote:

> On 09/08/2016 06:54 AM, amgstc@gmail.com wrote:
> [snip]
>
>>     "It is good programming style to use the break, continue, and return
>> statements instead of the goto statement whenever possible. However,
>> because the break statement exits from only one level of a loop, you
>> might have to use a goto statement to exit a deeply nested loop."
>>
>>     while ( cond1 )
>>     {
>>         while ( cond2 )
>>         {
>>             if ( cond3 )
>>             {
>>                 *goto LabelEndLoops;*
>>             }
>>         }**
>>     }
>>
>> *    LabelEndLoops;*
>>
>>
>>    ***solution 3 )* proposal...break( n )
>>
>>     while ( cond1 )
>>     {
>>         while ( cond2 )
>>         {
>>             if ( cond3 )
>>             {
>>                *break( 2 ); *
>>             }
>>         }
>>     }
>>
>>     This is very simple to solve by compiler, it just needs to replace
>> internally by a goto statement.
>>
>>         *break( 1 )* = *break*  exits from 1 loop
>>         *break( n )* exits from n loops
>>         *break( * )* exits from all loops
>>
>> [snip]
>
> Years ago (1980's or maybe 1970's) there was an article
> describing a language with, instead of:
>
>    break(levels_to_exit)
>
> it was
>
>   exit(levels_to_exit)
>
> and I think just a loop keyword.  The article showed how to
> transform any goto program to one just using this exit and
> loop and if-then-else.
>
> I've tried to find the reference without success.  I'll
> continue looking if anyone's interested.
>
> -regards,
> Larry
>
>
> --
> 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/is
> ocpp.org/d/msgid/std-proposals/nqrkga%24hgr%241%40blaine.gmane.org.
>

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

--001a11401fba528e2d053bfdfee3
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It was considered I think at least 2 times in very long th=
reads in the last 2 years in this very discussion group.<div>You should be =
able to find it by searching &quot;break&quot; with another keyword.</div><=
/div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On 8 Septemb=
er 2016 at 14:10, Larry Evans <span dir=3D"ltr">&lt;<a href=3D"mailto:cpplj=
evans@suddenlink.net" target=3D"_blank">cppljevans@suddenlink.net</a>&gt;</=
span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e=
x;border-left:1px #ccc solid;padding-left:1ex">On 09/08/2016 06:54 AM, <a h=
ref=3D"mailto:amgstc@gmail.com" target=3D"_blank">amgstc@gmail.com</a> wrot=
e:<br>
[snip]<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><span class=3D"">
=C2=A0 =C2=A0 &quot;It is good programming style to use the break, continue=
, and return<br>
statements instead of the goto statement whenever possible. However,<br>
because the break statement exits from only one level of a loop, you<br>
might have to use a goto statement to exit a deeply nested loop.&quot;<br>
<br>
=C2=A0 =C2=A0 while ( cond1 )<br>
=C2=A0 =C2=A0 {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 while ( cond2 )<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ( cond3 )<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br></span>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *goto LabelEndLoops=
;*<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }**<br>
=C2=A0 =C2=A0 }<br>
<br>
*=C2=A0 =C2=A0 LabelEndLoops;*<br>
<br>
<br>
=C2=A0 =C2=A0***solution 3 )* proposal...break( n )<span class=3D""><br>
<br>
=C2=A0 =C2=A0 while ( cond1 )<br>
=C2=A0 =C2=A0 {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 while ( cond2 )<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ( cond3 )<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br></span>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*break( 2 ); *<span =
class=3D""><br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
=C2=A0 =C2=A0 }<br>
<br>
=C2=A0 =C2=A0 This is very simple to solve by compiler, it just needs to re=
place<br>
internally by a goto statement.<br>
<br></span>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 *break( 1 )* =3D *break*=C2=A0 exits from 1 loo=
p<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 *break( n )* exits from n loops<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 *break( * )* exits from all loops<br>
<br>
</blockquote>
[snip]<br>
<br>
Years ago (1980&#39;s or maybe 1970&#39;s) there was an article<br>
describing a language with, instead of:<br>
<br>
=C2=A0 =C2=A0break(levels_to_exit)<br>
<br>
it was<br>
<br>
=C2=A0 exit(levels_to_exit)<br>
<br>
and I think just a loop keyword.=C2=A0 The article showed how to<br>
transform any goto program to one just using this exit and<br>
loop and if-then-else.<br>
<br>
I&#39;ve tried to find the reference without success.=C2=A0 I&#39;ll<br>
continue looking if anyone&#39;s interested.<br>
<br>
-regards,<br>
Larry<span class=3D""><br>
<br>
<br>
-- <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%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isoc<wbr>pp.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></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/nqrkga%24hgr%241%40blaine.gmane.org" =
rel=3D"noreferrer" target=3D"_blank">https://groups.google.com/a/is<wbr>ocp=
p.org/d/msgid/std-proposals<wbr>/nqrkga%24hgr%241%40blaine.<wbr>gmane.org</=
a>.<br>
</blockquote></div><br></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/CAOU91ONC8ePHY8TybAT3R%3DcajsYsV9tvBc=
01d8tuKqPy41BbLw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOU91ONC8ePHY8=
TybAT3R%3DcajsYsV9tvBc01d8tuKqPy41BbLw%40mail.gmail.com</a>.<br />

--001a11401fba528e2d053bfdfee3--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 8 Sep 2016 15:17:32 +0300
Raw View
On 8 September 2016 at 15:16, Klaim - Jo=C3=ABl Lamotte <mjklaim@gmail.com>=
 wrote:
> It was considered I think at least 2 times in very long threads in the la=
st
> 2 years in this very discussion group.
> You should be able to find it by searching "break" with another keyword.


Also, this paper http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3879.=
pdf
was discussed and rejected in Rapperswil.

--=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/CAFk2RUa%2BCwyBcps%2B4J_YCyNbigVP5Ee2n67cKW4XuDC=
0UE56eA%40mail.gmail.com.

.


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 05:30:11 -0700 (PDT)
Raw View
------=_Part_295_919270631.1473337811476
Content-Type: multipart/alternative;
 boundary="----=_Part_296_774167247.1473337811482"

------=_Part_296_774167247.1473337811482
Content-Type: text/plain; charset=UTF-8

Well that paper proposal allows "break" with an optional identifier which
needs to define an extra label, therefore is very similar to a goto. Don't
make sense to me.

This is about exiting loops easily with just an optional number telling how
many loops exit.

--
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/7405f461-6abb-4d91-8493-f6dcbf171ca4%40isocpp.org.

------=_Part_296_774167247.1473337811482
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Well that paper proposal allows &quot;break&quot; with an =
optional identifier which needs to define an extra label, therefore is very=
 similar to a goto. Don&#39;t make sense to me. <br><br>This is about exiti=
ng loops easily with just an optional number telling how many loops exit.<b=
r></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/7405f461-6abb-4d91-8493-f6dcbf171ca4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7405f461-6abb-4d91-8493-f6dcbf171ca4=
%40isocpp.org</a>.<br />

------=_Part_296_774167247.1473337811482--

------=_Part_295_919270631.1473337811476--

.


Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Thu, 8 Sep 2016 14:39:46 +0200
Raw View
--001a114013b43203ef053bfe53a3
Content-Type: text/plain; charset=UTF-8

On 8 September 2016 at 14:30, <amgstc@gmail.com> wrote:

> This is about exiting loops easily with just an optional number telling
> how many loops exit.


I remember that this option was discussed a lot because it cause the break
to have a relative meaning, which does not work well with code that change.
The discussion converged to a preference to a way to name the section of
the code (either label or an alternativ) which is associated to the break.

--
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/CAOU91OO2qyR%3DxanZnHLG%2B9RYxyAJSUay%3DkOXsDwSf%2B7k_8F_iw%40mail.gmail.com.

--001a114013b43203ef053bfe53a3
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On 8 September 2016 at 14:30,  <span dir=3D"ltr">&lt;<a href=3D"mailto:amgs=
tc@gmail.com" target=3D"_blank">amgstc@gmail.com</a>&gt;</span> wrote:<br><=
blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px=
 #ccc solid;padding-left:1ex">This is about exiting loops easily with just =
an optional number telling how many loops exit.</blockquote></div><br>I rem=
ember that this option was discussed a lot because it cause the break to ha=
ve a relative meaning, which does not work well with code that change.</div=
><div class=3D"gmail_extra">The discussion converged to a preference to a w=
ay to name the section of the code (either label or an alternativ) which is=
 associated to the break.</div><div class=3D"gmail_extra"><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/CAOU91OO2qyR%3DxanZnHLG%2B9RYxyAJSUay=
%3DkOXsDwSf%2B7k_8F_iw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoo=
ter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOU91OO2=
qyR%3DxanZnHLG%2B9RYxyAJSUay%3DkOXsDwSf%2B7k_8F_iw%40mail.gmail.com</a>.<br=
 />

--001a114013b43203ef053bfe53a3--

.


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 05:55:12 -0700 (PDT)
Raw View
------=_Part_1285_1042937315.1473339312474
Content-Type: multipart/alternative;
 boundary="----=_Part_1286_214828951.1473339312474"

------=_Part_1286_214828951.1473339312474
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

"break" already has a relative meaning, it is relative to current loop.=20
This just extends to more than one, no need of labels otherwise we already=
=20
have "goto".


On Thursday, September 8, 2016 at 2:39:49 PM UTC+2, Klaim - Jo=C3=ABl Lamot=
te=20
wrote:
>
>
> On 8 September 2016 at 14:30, <amg...@gmail.com <javascript:>> wrote:
>
>> This is about exiting loops easily with just an optional number telling=
=20
>> how many loops exit.
>
>
> I remember that this option was discussed a lot because it cause the brea=
k=20
> to have a relative meaning, which does not work well with code that chang=
e.
> The discussion converged to a preference to a way to name the section of=
=20
> the code (either label or an alternativ) which is associated to the break=
..
>
>

--=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/5fbdd991-3b91-4ff1-ae2f-434dfa19534f%40isocpp.or=
g.

------=_Part_1286_214828951.1473339312474
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">&quot;break&quot; already has a relative meaning, it is re=
lative to current loop. This just extends to more than one, no need of labe=
ls otherwise we already have &quot;goto&quot;.<br><br><br>On Thursday, Sept=
ember 8, 2016 at 2:39:49 PM UTC+2, Klaim - Jo=C3=ABl Lamotte wrote:<blockqu=
ote 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><br><div class=
=3D"gmail_quote">On 8 September 2016 at 14:30,  <span dir=3D"ltr">&lt;<a hr=
ef=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"EHxLMj7VFAAJ"=
 rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return t=
rue;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">amg...@gma=
il.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is abou=
t exiting loops easily with just an optional number telling how many loops =
exit.</blockquote></div><br>I remember that this option was discussed a lot=
 because it cause the break to have a relative meaning, which does not work=
 well with code that change.</div><div>The discussion converged to a prefer=
ence to a way to name the section of the code (either label or an alternati=
v) which is associated to the break.</div><div><br></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/5fbdd991-3b91-4ff1-ae2f-434dfa19534f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5fbdd991-3b91-4ff1-ae2f-434dfa19534f=
%40isocpp.org</a>.<br />

------=_Part_1286_214828951.1473339312474--

------=_Part_1285_1042937315.1473339312474--

.


Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Thu, 8 Sep 2016 15:07:06 +0200
Raw View
--001a113ebaa6ef44ad053bfeb4e2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 8 September 2016 at 14:55, <amgstc@gmail.com> wrote:

> "break" already has a relative meaning, it is relative to current loop.
> This just extends to more than one, no need of labels otherwise we alread=
y
> have "goto".
>
>
If you use numbers to express how many scopes to break from, then it's a
relative break. If you name the scope to exit from, it's not relative at
all.


>
> On Thursday, September 8, 2016 at 2:39:49 PM UTC+2, Klaim - Jo=C3=ABl Lam=
otte
> wrote:
>>
>>
>> On 8 September 2016 at 14:30, <amg...@gmail.com> wrote:
>>
>>> This is about exiting loops easily with just an optional number telling
>>> how many loops exit.
>>
>>
>> I remember that this option was discussed a lot because it cause the
>> break to have a relative meaning, which does not work well with code tha=
t
>> change.
>> The discussion converged to a preference to a way to name the section of
>> the code (either label or an alternativ) which is associated to the brea=
k.
>>
>> --
> 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/5fbdd991-3b91-4ff1-
> ae2f-434dfa19534f%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5fbdd991-3b=
91-4ff1-ae2f-434dfa19534f%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/CAOU91OObKywt%3DMHGiSJ9Wh6ys1QmxuPHqXjfb5qqZuzcD=
YOL8g%40mail.gmail.com.

--001a113ebaa6ef44ad053bfeb4e2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On 8 September 2016 at 14:55,  <span dir=3D"ltr">&lt;<a href=3D"mailto:=
amgstc@gmail.com" target=3D"_blank">amgstc@gmail.com</a>&gt;</span> wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">&quot;break&quot; alread=
y has a relative meaning, it is relative to current loop. This just extends=
 to more than one, no need of labels otherwise we already have &quot;goto&q=
uot;.<br><br></div></blockquote><div><br></div><div>If you use numbers to e=
xpress how many scopes to break from, then it&#39;s a relative break. If yo=
u name the scope to exit from, it&#39;s not relative at all.</div><div>=C2=
=A0</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>On Thursday, S=
eptember 8, 2016 at 2:39:49 PM UTC+2, Klaim - Jo=C3=ABl Lamotte wrote:<span=
 class=3D""><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><=
br><div class=3D"gmail_quote">On 8 September 2016 at 14:30,  <span dir=3D"l=
tr">&lt;<a rel=3D"nofollow">amg...@gmail.com</a>&gt;</span> wrote:<br><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex">This is about exiting loops easily with just an o=
ptional number telling how many loops exit.</blockquote></div><br>I remembe=
r that this option was discussed a lot because it cause the break to have a=
 relative meaning, which does not work well with code that change.</div><di=
v>The discussion converged to a preference to a way to name the section of =
the code (either label or an alternativ) which is associated to the break.<=
/div><div><br></div></div>
</blockquote></span></div><span class=3D"">

<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@<wbr>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></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5fbdd991-3b91-4ff1-ae2f-434dfa19534f%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/5fbd=
d991-3b91-4ff1-<wbr>ae2f-434dfa19534f%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div></div>

<p></p>

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

--001a113ebaa6ef44ad053bfeb4e2--

.


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 06:29:30 -0700 (PDT)
Raw View
------=_Part_334_163596865.1473341370073
Content-Type: multipart/alternative;
 boundary="----=_Part_335_289514469.1473341370074"

------=_Part_335_289514469.1473341370074
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

There is already a implicit number of 1 in the break, so the standard c++=
=20
break it is *already* a relative break, this do not changes the behaviour,=
=20
just extends it.


On Thursday, September 8, 2016 at 3:07:09 PM UTC+2, Klaim - Jo=C3=ABl Lamot=
te=20
wrote:
>
>
>
> On 8 September 2016 at 14:55, <amg...@gmail.com <javascript:>> wrote:
>
>> "break" already has a relative meaning, it is relative to current loop.=
=20
>> This just extends to more than one, no need of labels otherwise we alrea=
dy=20
>> have "goto".
>>
>>
> If you use numbers to express how many scopes to break from, then it's a=
=20
> relative break. If you name the scope to exit from, it's not relative at=
=20
> all.
> =20
>
>>
>> On Thursday, September 8, 2016 at 2:39:49 PM UTC+2, Klaim - Jo=C3=ABl La=
motte=20
>> wrote:
>>>
>>>
>>> On 8 September 2016 at 14:30, <amg...@gmail.com> wrote:
>>>
>>>> This is about exiting loops easily with just an optional number tellin=
g=20
>>>> how many loops exit.
>>>
>>>
>>> I remember that this option was discussed a lot because it cause the=20
>>> break to have a relative meaning, which does not work well with code th=
at=20
>>> change.
>>> The discussion converged to a preference to a way to name the section o=
f=20
>>> the code (either label or an alternativ) which is associated to the bre=
ak.
>>>
>>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5fbdd991-3b=
91-4ff1-ae2f-434dfa19534f%40isocpp.org=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5fbdd991-3=
b91-4ff1-ae2f-434dfa19534f%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
>
>

--=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/7dea3c4e-5817-4971-82a8-f39c8f7cd714%40isocpp.or=
g.

------=_Part_335_289514469.1473341370074
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">There is already a implicit number of 1 in the break, so t=
he standard c++ break it is <b>already</b> a relative break, this do not ch=
anges the behaviour, just extends it.<br><br><br>On Thursday, September 8, =
2016 at 3:07:09 PM UTC+2, Klaim - Jo=C3=ABl Lamotte wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><br><div><br><div class=3D"gma=
il_quote">On 8 September 2016 at 14:55,  <span dir=3D"ltr">&lt;<a href=3D"j=
avascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"rSqsHbzWFAAJ" rel=3D=
"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" o=
nclick=3D"this.href=3D&#39;javascript:&#39;;return true;">amg...@gmail.com<=
/a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:=
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">&q=
uot;break&quot; already has a relative meaning, it is relative to current l=
oop. This just extends to more than one, no need of labels otherwise we alr=
eady have &quot;goto&quot;.<br><br></div></blockquote><div><br></div><div>I=
f you use numbers to express how many scopes to break from, then it&#39;s a=
 relative break. If you name the scope to exit from, it&#39;s not relative =
at all.</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"><br>On Thursday, September 8, 2016 at 2:39:49 PM UTC+2, Klaim - Jo=C3=AB=
l Lamotte wrote:<span><blockquote class=3D"gmail_quote" style=3D"margin:0;m=
argin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"l=
tr"><div><br><div class=3D"gmail_quote">On 8 September 2016 at 14:30,  <spa=
n dir=3D"ltr">&lt;<a rel=3D"nofollow">amg...@gmail.com</a>&gt;</span> wrote=
:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">This is about exiting loops easily with=
 just an optional number telling how many loops exit.</blockquote></div><br=
>I remember that this option was discussed a lot because it cause the break=
 to have a relative meaning, which does not work well with code that change=
..</div><div>The discussion converged to a preference to a way to name the s=
ection of the code (either label or an alternativ) which is associated to t=
he break.</div><div><br></div></div>
</blockquote></span></div><span>

<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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
rSqsHbzWFAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"rSqsHbzWFAAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5fbdd991-3b91-4ff1-ae2f-434dfa19534f%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/5fbdd991-3b91-4ff1-ae2f-434dfa19534f%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/5fbdd991-3b91-4ff1-ae2f-434dfa19534f%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/5fbdd991-3b91-4ff1-<wbr>ae2f-=
434dfa19534f%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></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/7dea3c4e-5817-4971-82a8-f39c8f7cd714%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7dea3c4e-5817-4971-82a8-f39c8f7cd714=
%40isocpp.org</a>.<br />

------=_Part_335_289514469.1473341370074--

------=_Part_334_163596865.1473341370073--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 8 Sep 2016 06:32:58 -0700 (PDT)
Raw View
------=_Part_4798_157777179.1473341578708
Content-Type: multipart/alternative;
 boundary="----=_Part_4799_71770084.1473341578708"

------=_Part_4799_71770084.1473341578708
Content-Type: text/plain; charset=UTF-8

On Thursday, September 8, 2016 at 7:54:14 AM UTC-4, amg...@gmail.com wrote:
>
>     In order to exit from a nested loop when a condition is found you need
> to add an extra condition to ckeck in each external loop:
>
>
>     while ( cond1 )
>     {
>         bool found = false;
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 found = true;
>                 *break;*
>             }
>         }
>
>         if ( found )
>         {
>             *break;*
>         }
>     }
>
>
>     *solution 1 ) *elegant but slow to code: declare a new method, move
> that double bucle to that method and use return
>
>
>     void    test()
>     {
>         while ( cond1 )
>         {
>             while ( cond2 )
>             {
>                 if ( cond3 )
>                 {
> *                    return*;
>                 }
>             }
>         }
>     }
>
>  *   solution 2 *) use goto ( faster to code but uglier style )
>
>
> https://msdn.microsoft.com/en-us/library/b34dt9cd.aspx?f=255&MSPPError=-2147217396
>
>     "It is good programming style to use the break, continue, and return
> statements instead of the goto statement whenever possible. However,
> because the break statement exits from only one level of a loop, you might
> have to use a goto statement to exit a deeply nested loop."
>
>     while ( cond1 )
>     {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 *goto LabelEndLoops;*
>             }
>         }
>     }
>
> *    LabelEndLoops;*
>
>
>     *solution 3 )* proposal... break( n )
>
>     while ( cond1 )
>     {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                * break( 2 ); *
>             }
>         }
>     }
>
>     This is very simple to solve by compiler, it just needs to replace
> internally by a goto statement.
>
>         *break( 1 )* = *break*  exits from 1 loop
>         *break( n )* exits from n loops
>         *break( * )* exits from all loops
>
>     or if you prefer break1, breakN, break* without the parenthesis
> instead is also acceptable.
>     ( In case of symbol * cannot be used, it can be replaced by any more
> convenient. )
>

Personally, I feel like cases like this are sufficiently rare that `goto`
usage is perfectly acceptable. `goto` is for exceptional circumstances, and
this is one of them.

Also, `goto` feels *safer* in these cases, for two reasons:

1. You can easily find *exactly* where the `goto` will go. Whereas if you
have compound looping constructs, your code is likely growing quite large.
So finding where a `break(3)` statement will go will be difficult.

2. If you add another level of looping, which is entirely possible
considering that you have 2 or more already, your `goto` will still go to
the same place. Whereas you have to find all your `break(2)` statements and
turn them into `break(3)`.

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

------=_Part_4799_71770084.1473341578708
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, September 8, 2016 at 7:54:14 AM UTC-4, amg...=
@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr">=C2=A0=C2=A0=C2=A0 In order to exit from a nested loop when a condition=
 is found you need to add an extra condition to ckeck in each external loop=
:<br><br><br>=C2=A0=C2=A0=C2=A0 while ( cond1 )<br>=C2=A0=C2=A0=C2=A0 {<br>=
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 bool found =3D false;<br>=C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 while ( cond2 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=
=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if =
( cond3 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=
 found =3D true;<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 =C2=A0=C2=A0=C2=A0 <span style=3D"color:rgb(255,0,0)"><b>break;</b></sp=
an><br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<br>=C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<br><br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 if ( found )<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { <br>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <b><span style=
=3D"color:rgb(255,0,0)">break;</span></b><br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 }=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 }<br><br><br>=C2=A0=C2=A0=
=C2=A0 <b>solution 1 ) </b>elegant but slow to code: declare a new method, =
move that double bucle to that method and use return<br>=C2=A0=C2=A0=C2=A0 =
<br><br>=C2=A0=C2=A0=C2=A0 void=C2=A0=C2=A0=C2=A0 test()<br>=C2=A0=C2=A0=C2=
=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 while ( cond1 )<br>=C2=A0=C2=
=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=
=A0=C2=A0=C2=A0 while ( cond2 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 if ( cond3 )<span style=3D"color:rgb(255,0,0)"><b=
><br></b><span style=3D"color:rgb(68,68,68)">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {</span><b><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return</b></span>;=C2=A0=C2=A0=C2=A0=
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 }<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }=C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 }<br><br>=C2=A0<b>=C2=A0=C2=A0 s=
olution 2 </b>) use <span style=3D"color:rgb(255,0,0)">goto</span> ( faster=
 to code but uglier style )<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 <a=
 href=3D"https://msdn.microsoft.com/en-us/library/b34dt9cd.aspx?f=3D255&amp=
;MSPPError=3D-2147217396" target=3D"_blank" rel=3D"nofollow" onmousedown=3D=
"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmsdn.micros=
oft.com%2Fen-us%2Flibrary%2Fb34dt9cd.aspx%3Ff%3D255%26MSPPError%3D-21472173=
96\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDYPigZD0Veldxyzvt9GIJyx2yRw&#39=
;;return true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3=
dhttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fb34dt9cd.aspx%3Ff%3D2=
55%26MSPPError%3D-2147217396\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDYPig=
ZD0Veldxyzvt9GIJyx2yRw&#39;;return true;">https://msdn.microsoft.com/en-<wb=
r>us/library/b34dt9cd.aspx?f=3D<wbr>255&amp;MSPPError=3D-2147217396</a><br>=
<br>=C2=A0=C2=A0=C2=A0 &quot;It is good programming style to use the break,=
 continue, and return statements instead of the goto statement whenever pos=
sible. However, because the break statement exits from only one level of a =
loop, you might have to use a goto statement to exit a deeply nested loop.&=
quot;<br><br>=C2=A0=C2=A0=C2=A0 while ( cond1 )<br>=C2=A0=C2=A0=C2=A0 {<br>=
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 while ( cond2 )<br>=C2=A0=C2=A0=C2=A0=
 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 if ( cond3 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 {=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <span style=3D"col=
or:rgb(255,0,0)"><b>goto LabelEndLoops;</b></span><br>=C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 }<b><span style=3D"color:rgb(255,0,0)"></span></b><br>=C2=A0=C2=A0=
=C2=A0 }<br><br><span style=3D"color:rgb(255,0,0)"><b>=C2=A0=C2=A0=C2=A0 La=
belEndLoops;</b></span><br><br><br>=C2=A0=C2=A0=C2=A0<b> </b><span style=3D=
"color:rgb(0,0,0)"><b>solution 3 )</b> </span>proposal...<span style=3D"col=
or:rgb(255,0,0)"> break( n )</span><br><br>=C2=A0=C2=A0=C2=A0 while ( cond1=
 )<br>=C2=A0=C2=A0=C2=A0 {=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <br>=C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 while ( cond2 )<br>=C2=A0=C2=A0=C2=A0 =C2=
=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 if ( cond3 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=
=A0=C2=A0<b><span style=3D"color:rgb(255,0,0)"> break( 2 ); </span></b><br>=
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 }<br><br>=C2=A0=C2=A0=C2=
=A0 This is very simple to solve by compiler, it just needs to replace inte=
rnally by a goto statement.<br><br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <b=
>break( 1 )</b> =3D <b>break</b>=C2=A0 exits from 1 loop<br>=C2=A0=C2=A0=C2=
=A0 =C2=A0=C2=A0=C2=A0 <b>break( n )</b> exits from n loops<br>=C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 <b>break( * )</b> exits from all loops<br><br>=C2=
=A0=C2=A0=C2=A0 or if you prefer break1, breakN, break* without the parenth=
esis instead is also acceptable.<br>=C2=A0=C2=A0=C2=A0 ( In case of symbol =
* cannot be used, it can be replaced by any more convenient. )<br></div></b=
lockquote><div><br>Personally, I feel like cases like this are sufficiently=
 rare that `goto` usage is perfectly acceptable. `goto` is for exceptional =
circumstances, and this is one of them.<br><br>Also, `goto` feels <i>safer<=
/i> in these cases, for two reasons:<br><br>1. You can easily find <i>exact=
ly</i> where the `goto` will go. Whereas if you have compound looping const=
ructs, your code is likely growing quite large. So finding where a `break(3=
)` statement will go will be difficult.<br><br>2. If you add another level =
of looping, which is entirely possible considering that you have 2 or more =
already, your `goto` will still go to the same place. Whereas you have to f=
ind all your `break(2)` statements and turn them into `break(3)`.<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/948c76cf-d7b9-4e3e-9201-a577a2548fc6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/948c76cf-d7b9-4e3e-9201-a577a2548fc6=
%40isocpp.org</a>.<br />

------=_Part_4799_71770084.1473341578708--

------=_Part_4798_157777179.1473341578708--

.


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 07:36:05 -0700 (PDT)
Raw View
------=_Part_511_662145658.1473345365524
Content-Type: multipart/alternative;
 boundary="----=_Part_512_1514392181.1473345365524"

------=_Part_512_1514392181.1473345365524
Content-Type: text/plain; charset=UTF-8

Problem is these cases are not so rare. Everything that is composed of more
than 1 dimension, like images, databases, matrixes, etc, requieres 2 or
more loops to apply most of algorithms to them ( usually everything
composed of row and columns )
for example: to search for an element and abort when the condition is
found. There is a lot of algorithms than needs to deal with mutliple
dimensional objects, so this situation is a lot more frequent than expected.

Anyway this not about replacing goto, anyone can keep using it, though
similar problems you describes applies to goto too:
If algorithm is modified or adjusted it may requiere the label to be moved,
otherwise algorithm will fail aswell.
If I do break( 2 ) i know exactly how many loops I exit. If I do a goto,
can be anywhere in the method, even in previous lines, so finding where
label is located can be even harder.

Besides adding an external loop, do not forces to have to increase break( 2
) to break( 3 ), if algorithm is looping an image, that image is
2-dimensional and it will keep break( 2 ).
At the end depending on the algorithm the exit of the loops with a break( n
) it is more suitable than the goto generic behaviour ( it goes anywhere )
is not specific for breaking, just used because we have no other better
choice.


On Thursday, September 8, 2016 at 3:32:59 PM UTC+2, Nicol Bolas wrote:
>
>
>
> Personally, I feel like cases like this are sufficiently rare that `goto`
> usage is perfectly acceptable. `goto` is for exceptional circumstances, and
> this is one of them.
>
> Also, `goto` feels *safer* in these cases, for two reasons:
>
> 1. You can easily find *exactly* where the `goto` will go. Whereas if you
> have compound looping constructs, your code is likely growing quite large.
> So finding where a `break(3)` statement will go will be difficult.
>
> 2. If you add another level of looping, which is entirely possible
> considering that you have 2 or more already, your `goto` will still go to
> the same place. Whereas you have to find all your `break(2)` statements and
> turn them into `break(3)`.
>

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ad5ac6b7-594e-467c-a008-46211f2bee65%40isocpp.org.

------=_Part_512_1514392181.1473345365524
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Problem is these cases are not so rare. Everything that is=
 composed of=20
more than 1 dimension, like images, databases, matrixes, etc, requieres 2
 or more loops to apply most of algorithms to them ( usually everything=20
composed of row and columns )<br>for example: to search for an element=20
and abort when the condition is found. There is a lot of algorithms than
 needs to deal with mutliple dimensional objects, so this situation is a
 lot more frequent than expected.<br><br>Anyway this not about replacing go=
to, anyone can keep using it, though similar problems you describes applies=
 to goto too:<br>If algorithm is modified or adjusted it may requiere the l=
abel to be moved, otherwise algorithm will fail aswell. <br>If
 I do break( 2 ) i know exactly how many loops I exit. If I do a goto,=20
can be anywhere in the method, even in previous lines, so finding where=20
label is located can be even harder.<br><br>Besides adding an external=20
loop, do not forces to have to increase break( 2 ) to break( 3 ), if=20
algorithm is looping an image, that image is 2-dimensional and it will=20
keep break( 2 ).<br>At the end depending on the algorithm the exit of=20
the loops with a break( n ) it is more suitable than the goto generic=20
behaviour ( it goes anywhere ) is not specific for breaking, just used=20
because we have no other better choice. <br><br><br>On Thursday, September =
8, 2016 at 3:32:59 PM UTC+2, Nicol Bolas wrote:<blockquote class=3D"gmail_q=
uote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pad=
ding-left: 1ex;"><div dir=3D"ltr"><br><div><br>Personally, I feel like case=
s like this are sufficiently rare that `goto` usage is perfectly acceptable=
.. `goto` is for exceptional circumstances, and this is one of them.<br><br>=
Also, `goto` feels <i>safer</i> in these cases, for two reasons:<br><br>1. =
You can easily find <i>exactly</i> where the `goto` will go. Whereas if you=
 have compound looping constructs, your code is likely growing quite large.=
 So finding where a `break(3)` statement will go will be difficult.<br><br>=
2. If you add another level of looping, which is entirely possible consider=
ing that you have 2 or more already, your `goto` will still go to the same =
place. Whereas you have to find all your `break(2)` statements and turn the=
m into `break(3)`.<br></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/ad5ac6b7-594e-467c-a008-46211f2bee65%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ad5ac6b7-594e-467c-a008-46211f2bee65=
%40isocpp.org</a>.<br />

------=_Part_512_1514392181.1473345365524--

------=_Part_511_662145658.1473345365524--

.


Author: Peter Koch Larsen <peter.koch.larsen@gmail.com>
Date: Thu, 8 Sep 2016 16:52:19 +0200
Raw View
On Thu, Sep 8, 2016 at 1:54 PM,  <amgstc@gmail.com> wrote:
>     In order to exit from a nested loop when a condition is found you need
> to add an extra condition to ckeck in each external loop:
>
>
>     while ( cond1 )
>     {
>         bool found = false;
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 found = true;
>                 break;
>             }
>         }
>
>         if ( found )
>         {
>             break;
>         }
>     }
>
>
>     solution 1 ) elegant but slow to code: declare a new method, move that
> double bucle to that method and use return
>
>
>     void    test()
>     {
>         while ( cond1 )
>         {
>             while ( cond2 )
>             {
>                 if ( cond3 )
>                 {
>                     return;
>                 }
>             }
>         }
>     }
>
>     solution 2 ) use goto ( faster to code but uglier style )
>
>
> https://msdn.microsoft.com/en-us/library/b34dt9cd.aspx?f=255&MSPPError=-2147217396
>
>     "It is good programming style to use the break, continue, and return
> statements instead of the goto statement whenever possible. However, because
> the break statement exits from only one level of a loop, you might have to
> use a goto statement to exit a deeply nested loop."
>
>     while ( cond1 )
>     {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 goto LabelEndLoops;
>             }
>         }
>     }
>
>     LabelEndLoops;
>
>
>     solution 3 ) proposal... break( n )
>
>     while ( cond1 )
>     {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 break( 2 );
>             }
>         }
>     }
>
>     This is very simple to solve by compiler, it just needs to replace
> internally by a goto statement.
>
>         break( 1 ) = break  exits from 1 loop
>         break( n ) exits from n loops
>         break( * ) exits from all loops
>
>     or if you prefer break1, breakN, break* without the parenthesis instead
> is also acceptable.
>     ( In case of symbol * cannot be used, it can be replaced by any more
> convenient. )
>
One problem with this proposal is that it promotes bad code. Sean
Parent has the good advice to avoid raw loops. To provide facilities
that support multiple nested loops is a step in the wrong  direction.
In the rare case where you can not split your nested loop into two or
more functions just use the goto statement which will also serve as a
reminder that this is an area of code where you have to be extra
careful if you change anything.

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

.


Author: Peter Koch Larsen <peter.koch.larsen@gmail.com>
Date: Thu, 8 Sep 2016 16:56:58 +0200
Raw View
On Thu, Sep 8, 2016 at 4:36 PM,  <amgstc@gmail.com> wrote:
> Problem is these cases are not so rare. Everything that is composed of more
> than 1 dimension, like images, databases, matrixes, etc, requieres 2 or more
> loops to apply most of algorithms to them ( usually everything composed of
> row and columns )
> for example: to search for an element and abort when the condition is found.
> There is a lot of algorithms than needs to deal with mutliple dimensional
> objects, so this situation is a lot more frequent than expected.
>
You do not need multiple loops to search for an element. You do not
need any raw loop at all, actually. Just use std::find_if.

/Peter

--
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/CANPtkny9120JEv%3DBwZLvXFo-JdUhMocJ7dv7CRvt_m3nD1oRCA%40mail.gmail.com.

.


Author: "D. B." <db0451@gmail.com>
Date: Thu, 8 Sep 2016 15:59:04 +0100
Raw View
--001a114e30725e8d65053c004585
Content-Type: text/plain; charset=UTF-8

On Thu, Sep 8, 2016 at 3:52 PM, Peter Koch Larsen <
peter.koch.larsen@gmail.com> wrote:

>
> One problem with this proposal is that it promotes bad code. Sean
> Parent has the good advice to avoid raw loops. To provide facilities
> that support multiple nested loops is a step in the wrong  direction.
> In the rare case where you can not split your nested loop into two or
> more functions just use the goto statement which will also serve as a
> reminder that this is an area of code where you have to be extra
> careful if you change anything.
>
>
This. The idea of 'relative break' based on some magic number of loop
levels is so brittle that it makes me wince.

GOTO is not inherently bad, just not used in the right places in most
cases. This is exactly such a place. It means you can have a *labelled*,
less fragile exit point.

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

--001a114e30725e8d65053c004585
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
hu, Sep 8, 2016 at 3:52 PM, Peter Koch Larsen <span dir=3D"ltr">&lt;<a href=
=3D"mailto:peter.koch.larsen@gmail.com" target=3D"_blank">peter.koch.larsen=
@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div cla=
ss=3D"HOEnZb"><div class=3D"h5"><br>
</div></div>One problem with this proposal is that it promotes bad code. Se=
an<br>
Parent has the good advice to avoid raw loops. To provide facilities<br>
that support multiple nested loops is a step in the wrong=C2=A0 direction.<=
br>
In the rare case where you can not split your nested loop into two or<br>
more functions just use the goto statement which will also serve as a<br>
reminder that this is an area of code where you have to be extra<br>
careful if you change anything.<br>
<span class=3D""></span><br></blockquote><div><br></div><div>This. The idea=
 of &#39;relative break&#39; based on some magic number of loop levels is s=
o brittle that it makes me wince.<br><br></div><div>GOTO is not inherently =
bad, just not used in the right places in most cases. This is exactly such =
a place. It means you can have a <i>labelled</i>, less fragile exit point.<=
br></div></div><br></div></div>

<p></p>

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

--001a114e30725e8d65053c004585--

.


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 08:14:23 -0700 (PDT)
Raw View
------=_Part_4084_1519526696.1473347663983
Content-Type: multipart/alternative;
 boundary="----=_Part_4085_1829531275.1473347663983"

------=_Part_4085_1829531275.1473347663983
Content-Type: text/plain; charset=UTF-8

Was trying to show an easy example, you can find infinite algorithms
looping an image looking for certain cummulative conditions that you cannot
use a simple templated std method to locate them, and needs specific
algorithm.

On Thursday, September 8, 2016 at 4:57:00 PM UTC+2, Peter Koch Larsen wrote:
>
> On Thu, Sep 8, 2016 at 4:36 PM,  <amg...@gmail.com <javascript:>> wrote:
> > Problem is these cases are not so rare. Everything that is composed of
> more
> > than 1 dimension, like images, databases, matrixes, etc, requieres 2 or
> more
> > loops to apply most of algorithms to them ( usually everything composed
> of
> > row and columns )
> > for example: to search for an element and abort when the condition is
> found.
> > There is a lot of algorithms than needs to deal with mutliple
> dimensional
> > objects, so this situation is a lot more frequent than expected.
> >
> You do not need multiple loops to search for an element. You do not
> need any raw loop at all, actually. Just use std::find_if.
>
>

> /Peter
>

--
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/c66dca85-ceaa-4333-a2b1-d8c74fa69273%40isocpp.org.

------=_Part_4085_1829531275.1473347663983
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Was trying to show an easy example, you can find infinite =
algorithms looping an image looking for certain cummulative conditions that=
 you cannot use a simple templated std method to locate them, and needs spe=
cific algorithm.<br><br>On Thursday, September 8, 2016 at 4:57:00 PM UTC+2,=
 Peter Koch Larsen wrote:<blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On Th=
u, Sep 8, 2016 at 4:36 PM, =C2=A0&lt;<a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"ABmUxbrcFAAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">amg...@gmail.com</a>&gt; wrote:
<br>&gt; Problem is these cases are not so rare. Everything that is compose=
d of more
<br>&gt; than 1 dimension, like images, databases, matrixes, etc, requieres=
 2 or more
<br>&gt; loops to apply most of algorithms to them ( usually everything com=
posed of
<br>&gt; row and columns )
<br>&gt; for example: to search for an element and abort when the condition=
 is found.
<br>&gt; There is a lot of algorithms than needs to deal with mutliple dime=
nsional
<br>&gt; objects, so this situation is a lot more frequent than expected.
<br>&gt;
<br>You do not need multiple loops to search for an element. You do not
<br>need any raw loop at all, actually. Just use std::find_if.
<br>
<br></blockquote><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;">/Peter
<br></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/c66dca85-ceaa-4333-a2b1-d8c74fa69273%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c66dca85-ceaa-4333-a2b1-d8c74fa69273=
%40isocpp.org</a>.<br />

------=_Part_4085_1829531275.1473347663983--

------=_Part_4084_1519526696.1473347663983--

.


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 08:59:09 -0700 (PDT)
Raw View
------=_Part_213_823925257.1473350349185
Content-Type: multipart/alternative;
 boundary="----=_Part_214_1805223837.1473350349185"

------=_Part_214_1805223837.1473350349185
Content-Type: text/plain; charset=UTF-8

You probably didn't realize that c++ break is already relative, it exits
from the current loop level. Where it exits? relative to the size of the
loop where you put the break. If the loop would have 1 thousand lines, it
would jump at the end to that code length.
'break' behaviour is very useful, so this break(n) extension is not
different.

Besides it's safer than it looks like:
With break(n) you can't go anywhere, you can't go backwards, you can't go
any other nested loop where it belongs. Just can continue at the end of own
nested loops.
And compiler can easily see if you try to break with a higher number than
existant loops and report.

And let's be clear and practical, how many nested loops do we have? 1, 2,
.... 3? other than that we split in other method, so we are not going to use
break( 17 ), aswell we can place one thousand goto's in a method but nobody
does it.
As you say GOTO is not inherently bad, I agree because at the end this is
coder responsability to create a good code or bad one, is not just the
instructions.
Pointers are potentially really dangerous, bad handled dynamic memory is,
unions are, etc... but we use them, welcome to C++.

break(n) is useful, clear, requieres no extra conditional check or define
extra label like goto, and it is easy to implement by compiler. It can be
translated with an internal goto, but transparent and safe, aswell it does
with the usual jumps in conditionals "if/else", "for", "do / while", etc

And the most important, it is* optional*, you can use it or not.



On Thursday, September 8, 2016 at 4:59:07 PM UTC+2, D. B. wrote:
>
> On Thu, Sep 8, 2016 at 3:52 PM, Peter Koch Larsen <peter.ko...@gmail.com
> <javascript:>> wrote:
>
>>
>> One problem with this proposal is that it promotes bad code. Sean
>> Parent has the good advice to avoid raw loops. To provide facilities
>> that support multiple nested loops is a step in the wrong  direction.
>> In the rare case where you can not split your nested loop into two or
>> more functions just use the goto statement which will also serve as a
>> reminder that this is an area of code where you have to be extra
>> careful if you change anything.
>>
>>
> This. The idea of 'relative break' based on some magic number of loop
> levels is so brittle that it makes me wince.
>
> GOTO is not inherently bad, just not used in the right places in most
> cases. This is exactly such a place. It means you can have a *labelled*,
> less fragile exit point.
>
>

--
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/c4a35105-c9dd-43de-9504-d79d6098cc67%40isocpp.org.

------=_Part_214_1805223837.1473350349185
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">You probably didn&#39;t realize that c++ break is already =
relative, it exits
 from the current loop level. Where it exits? relative to the size of the=
=20
loop where you put the break. If the loop would have 1 thousand lines, it w=
ould jump at the end to that code length. <br>&#39;break&#39; behaviour is =
very useful, so this break(n) extension is not different. <br><br>Besides i=
t&#39;s safer than it looks like: <br>With break(n) you can&#39;t go anywhe=
re, you can&#39;t go backwards, you can&#39;t go any other nested loop wher=
e it belongs. Just can continue at the end of own nested loops. <br>And com=
piler can easily see if you try to break with a higher number than existant=
 loops and report.<br><br>And let&#39;s be clear and practical, how many ne=
sted loops do we have? 1, 2, ... 3? other than that we split in other metho=
d, so we are not going to use break( 17 ), aswell we can place one thousand=
 goto&#39;s in a method but nobody does it.<br>As you say GOTO is not inher=
ently bad, I agree because at the end this is coder responsability to creat=
e a good code or bad one, is not just the instructions.<br>Pointers are pot=
entially really dangerous, bad handled dynamic memory is, unions are, etc..=
.. but we use them, welcome to C++.<br><br>break(n) is useful, clear, requie=
res no extra conditional check or define extra label like goto, and it is e=
asy to implement by compiler. It can be translated with an internal goto, b=
ut transparent and safe, aswell it does with the usual jumps in conditional=
s &quot;if/else&quot;, &quot;for&quot;, &quot;do / while&quot;, etc<br><br>=
And the most important, it is<b> optional</b>, you can use it or not.<br><b=
r><br><br>On Thursday, September 8, 2016 at 4:59:07 PM UTC+2, D. B. wrote:<=
blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bord=
er-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div clas=
s=3D"gmail_quote">On Thu, Sep 8, 2016 at 3:52 PM, Peter Koch Larsen <span d=
ir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mai=
lto=3D"fbNUSdjcFAAJ" 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;">peter.ko...@gmail.com</a>&gt;</span> wrote:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div><div><br>
</div></div>One problem with this proposal is that it promotes bad code. Se=
an<br>
Parent has the good advice to avoid raw loops. To provide facilities<br>
that support multiple nested loops is a step in the wrong=C2=A0 direction.<=
br>
In the rare case where you can not split your nested loop into two or<br>
more functions just use the goto statement which will also serve as a<br>
reminder that this is an area of code where you have to be extra<br>
careful if you change anything.<br>
<span></span><br></blockquote><div><br></div><div>This. The idea of &#39;re=
lative break&#39; based on some magic number of loop levels is so brittle t=
hat it makes me wince.<br><br></div><div>GOTO is not inherently bad, just n=
ot used in the right places in most cases. This is exactly such a place. It=
 means you can have a <i>labelled</i>, less fragile exit point.<br></div></=
div><br></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/c4a35105-c9dd-43de-9504-d79d6098cc67%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c4a35105-c9dd-43de-9504-d79d6098cc67=
%40isocpp.org</a>.<br />

------=_Part_214_1805223837.1473350349185--

------=_Part_213_823925257.1473350349185--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 8 Sep 2016 10:39:39 -0700 (PDT)
Raw View
------=_Part_2856_2062563999.1473356379174
Content-Type: multipart/alternative;
 boundary="----=_Part_2857_1559197789.1473356379174"

------=_Part_2857_1559197789.1473356379174
Content-Type: text/plain; charset=UTF-8

On Thursday, September 8, 2016 at 10:36:05 AM UTC-4, amg...@gmail.com wrote:
>
> Problem is these cases are not so rare. Everything that is composed of
> more than 1 dimension, like images, databases, matrixes, etc, requieres 2
> or more loops to apply most of algorithms to them ( usually everything
> composed of row and columns )
> for example: to search for an element and abort when the condition is
> found. There is a lot of algorithms than needs to deal with mutliple
> dimensional objects, so this situation is a lot more frequent than expected.
>

That sounds like a good reason to have a multidimensional iterator type so
that you can use `find_if`, not a first-class language feature.

And as you mention later, yes, there are other scenarios that cannot be
handled by a generic algorithm, even with a multi-dimensional iterator. But
again, such scenarios are so rare (made even moreso with multidimensional
iterators) that they're not worth adding a language feature to solve them.
Not so long as we already have a language feature that can handle it
adequately.

Anyway this not about replacing goto, anyone can keep using it, though
> similar problems you describes applies to goto too:
> If algorithm is modified or adjusted it may requiere the label to be
> moved, otherwise algorithm will fail aswell.
> If I do break( 2 ) i know exactly how many loops I exit. If I do a goto,
> can be anywhere in the method, even in previous lines, so finding where
> label is located can be even harder.
>

Finding a `goto` label is done via a simple string search. A good IDE can
give it to you by simply right-clicking and picking a menu-item, or with a
keyboard shortcut. Finding where `break 2` goes require finding the two
nearest loops, which may be off-screen.

On Thursday, September 8, 2016 at 11:59:09 AM UTC-4, amg...@gmail.com wrote:
>
> You probably didn't realize that c++ break is already relative, it exits
> from the current loop level. Where it exits? relative to the size of the
> loop where you put the break. If the loop would have 1 thousand lines, it
> would jump at the end to that code length.
> 'break' behaviour is very useful, so this break(n) extension is not
> different.
>

You can't just say that your feature is just as good as another, more
narrow feature, just because it does what the narrow feature does too.

`break` is tolerated precisely *because* it is narrow. It has its
fragilities, but doing a single jump out of a loop solves more problems
than it causes. The problems that `break(X)` solve are so rare that they're
not worth the problems that having such a feature will cause.

And let's be clear and practical, how many nested loops do we have? 1, 2,
> ... 3? other than that we split in other method, so we are not going to use
> break( 17 ), aswell we can place one thousand goto's in a method but nobody
> does it.
>

.... You seem to be arguing *against* your own feature. If you genuinely
only have 2 or 3 dimensions on such loops, then *what's the point* of this
"break-by-number" functionality?

break(n) is useful, clear, requieres no extra conditional check or define
> extra label like goto, and it is easy to implement by compiler. It can be
> translated with an internal goto, but transparent and safe, aswell it does
> with the usual jumps in conditionals "if/else", "for", "do / while", etc
>

>
And the most important, it is* optional*, you can use it or not.
>

Every language feature has a cost. It costs times for the committee to
evaluate and standardize a proposal. It costs compiler writers time to
implement it. It costs teaching time when users unfamiliar with it ask
about it.

Whether you personally use a language feature or not, you will still pay
these costs.

As such, any language feature must provide sufficient benefit, broadly, to
be worth that cost. To me, your proposal fails in two areas:

1. The amount of code that would benefit from its use is not significant
enough to be worth the costs of having it as a feature. While the existing
solutions are not ideal, they are *adequate* for those times when the
problem arises.

2. The use of this feature encourages the writing of low-quality code.

Oh, and there's another thing that makes your idea problematic. It doesn't
combine well with the proposal for a "for/else" mechanism
<http://wg21.link/P0082>. What would happen if you use `break(2)` and the
inner loop has an `else` clause (or whatever we want to call it)? By
limiting `break` to just one loop, we ensure that such a proposal still
makes sense.

--
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/ffbdc34b-a4b8-4114-ab18-5e6ed1fb2e3c%40isocpp.org.

------=_Part_2857_1559197789.1473356379174
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, September 8, 2016 at 10:36:05 AM UTC-4, amg..=
..@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr">Problem is these cases are not so rare. Everything that is composed of=
=20
more than 1 dimension, like images, databases, matrixes, etc, requieres 2
 or more loops to apply most of algorithms to them ( usually everything=20
composed of row and columns )<br>for example: to search for an element=20
and abort when the condition is found. There is a lot of algorithms than
 needs to deal with mutliple dimensional objects, so this situation is a
 lot more frequent than expected.<br></div></blockquote><div><br>That=20
sounds like a good reason to have a multidimensional iterator type so=20
that you can use `find_if`, not a first-class language feature.<br><br>And
 as you mention later, yes, there are other scenarios that cannot be=20
handled by a generic algorithm, even with a multi-dimensional iterator.=20
But again, such scenarios are so rare (made even moreso with multidimension=
al iterators) that they&#39;re not worth adding a=20
language feature to solve them. Not so long as we already have a=20
language feature that can handle it adequately.<br><br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Anyway this not about repla=
cing goto, anyone can keep using it, though similar problems you describes =
applies to goto too:<br>If algorithm is modified or adjusted it may requier=
e the label to be moved, otherwise algorithm will fail aswell. <br>If
 I do break( 2 ) i know exactly how many loops I exit. If I do a goto,=20
can be anywhere in the method, even in previous lines, so finding where=20
label is located can be even harder.<br></div></blockquote><div><br>Finding
 a `goto` label is done via a simple string search. A good IDE can give it =
to you by simply right-clicking and picking a menu-item, or with a keyboard=
 shortcut. Finding where `break
 2` goes require finding the two nearest loops, which may be off-screen.<br=
><br></div>On Thursday, September 8, 2016 at 11:59:09 AM UTC-4, amg...@gmai=
l.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Y=
ou probably didn&#39;t realize that c++ break is already relative, it exits
 from the current loop level. Where it exits? relative to the size of the=
=20
loop where you put the break. If the loop would have 1 thousand lines, it w=
ould jump at the end to that code length. <br>&#39;break&#39; behaviour is =
very useful, so this break(n) extension is not different. <br></div></block=
quote><div><br>You can&#39;t just say that your feature is just as good as =
another, more narrow feature, just because it does what the narrow feature =
does too.<br><br>`break` is tolerated precisely <i>because</i> it is narrow=
.. It has its fragilities, but doing a single jump out of a loop solves more=
 problems than it causes. The problems that `break(X)` solve are so rare th=
at they&#39;re not worth the problems that having such a feature will cause=
..<br><br></div><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=
">And let&#39;s be clear and practical, how many nested loops do we have? 1=
, 2, ... 3? other than that we split in other method, so we are not going t=
o use break( 17 ), aswell we can place one thousand goto&#39;s in a method =
but nobody does it.<br></div></blockquote><div><br>... You seem to be argui=
ng <i>against</i> your own feature. If you genuinely only have 2 or 3 dimen=
sions on such loops, then <i>what&#39;s the point</i> of this &quot;break-b=
y-number&quot; functionality?<br><br></div><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">break(n) is useful, clear, requieres no extra=
 conditional check or define extra label like goto, and it is easy to imple=
ment by compiler. It can be translated with an internal goto, but transpare=
nt and safe, aswell it does with the usual jumps in conditionals &quot;if/e=
lse&quot;, &quot;for&quot;, &quot;do / while&quot;, etc<br></div></blockquo=
te><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid r=
gb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote"><div>=C2=A0</d=
iv></blockquote><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r">And the most important, it is<b> optional</b>, you can use it or not.<br=
></div></blockquote><div><br>Every language feature has a cost. It costs ti=
mes for the committee to evaluate and standardize a proposal. It costs comp=
iler writers time to implement it. It costs teaching time when users unfami=
liar with it ask about it.<br><br>Whether you personally use a language fea=
ture or not, you will still pay these costs.<br><br>As such, any language f=
eature must provide sufficient benefit, broadly, to be worth that cost. To =
me, your proposal fails in two areas:<br><br>1. The amount of code that wou=
ld benefit from its use is not significant enough to be worth the costs of =
having it as a feature. While the existing solutions are not ideal, they ar=
e <i>adequate</i> for those times when the problem arises.<br><br>2. The us=
e of this feature encourages the writing of low-quality code.<br><br>Oh, an=
d there&#39;s another thing that makes your idea problematic. It doesn&#39;=
t combine well with <a href=3D"http://wg21.link/P0082">the proposal for a &=
quot;for/else&quot; mechanism</a>. What would happen if you use `break(2)` =
and the inner loop has an `else` clause (or whatever we want to call it)? B=
y limiting `break` to just one loop, we ensure that such a proposal still m=
akes sense.<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/ffbdc34b-a4b8-4114-ab18-5e6ed1fb2e3c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ffbdc34b-a4b8-4114-ab18-5e6ed1fb2e3c=
%40isocpp.org</a>.<br />

------=_Part_2857_1559197789.1473356379174--

------=_Part_2856_2062563999.1473356379174--

.


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 11:25:10 -0700 (PDT)
Raw View
------=_Part_2656_1579459530.1473359110787
Content-Type: multipart/alternative;
 boundary="----=_Part_2657_980104704.1473359110787"

------=_Part_2657_980104704.1473359110787
Content-Type: text/plain; charset=UTF-8


>
> Finding a `goto` label is done via a simple string search. A good IDE can
> give it to you by simply right-clicking and picking a menu-item, or with a
> keyboard shortcut. Finding where `break 2` goes require finding the two
> nearest loops, which may be off-screen.


Well, this is going to a too much more complicated issue that it started.
If you see my initial example, it is very simple, you do not need a 3 page
code to make use of it. What I mean is, if the code containing the inner
loops is complex enough you *should *split that code into another method
containing the loops, and this way you solve both: the break will be
replaced by a return, and the complexity of the method will decrease by
splling it.

But, as my example, if code is small enough due to inner code loops are
simple, you want a clean and fast exit. Splitting the method is discarded
in this case, so you only can use the goto or adding extra conditions.
That's why i proposed this break(n). The "goto" is not the more desirable
to use, either you want dirtier code with these extra conditions.
In fact I proposed the generic break(n), but probably with a break2 and a
break3 would be enough, as I said before, with a higher inner loops you
should split it.
This way it keeps simpler.



2. The use of this feature encourages the writing of low-quality code.
>

I don't see this as encouraging low-quality code, this way unnecessary
conditions aren't requiered, keep using the same keyword designed to break
loops, and also do not requieres the goto, which is worse and depends on
extra label.


Oh, and there's another thing that makes your idea problematic. It doesn't
> combine well with the proposal for a "for/else" mechanism
> <http://www.google.com/url?q=http%3A%2F%2Fwg21.link%2FP0082&sa=D&sntz=1&usg=AFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg>.
> What would happen if you use `break(2)` and the inner loop has an `else`
> clause (or whatever we want to call it)? By limiting `break` to just one
> loop, we ensure that such a proposal still makes sense.
>


I didn't know that proposal, but looks already incompatible by using goto
inside isn't? My proposal isn't incompatible with anything because
internally it can be translated to a goto by the compiler.



--
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/fd2cca88-3a6c-4849-a3ae-0f061bba60ba%40isocpp.org.

------=_Part_2657_980104704.1473359110787
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-lef=
t: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">=
Finding
 a `goto` label is done via a simple string search. A good IDE can give=20
it to you by simply right-clicking and picking a menu-item, or with a=20
keyboard shortcut. Finding where `break
 2` goes require finding the two nearest loops, which may be off-screen.</b=
lockquote><div><br>Well, this is going to a too much more complicated issue=
 that it started. If you see my initial example, it is very simple, you do =
not need a 3 page code to make use of it. What I mean is, if the code conta=
ining the inner loops is complex enough you <b>should </b>split that code i=
nto another method containing the loops, and this way you solve both: the b=
reak will be replaced by a return, and the complexity of the method will de=
crease by splling it.<br><br>But, as my example, if code is small enough du=
e to inner code loops are simple, you want a clean and fast exit. Splitting=
 the method is discarded in this case, so you only can use the goto or addi=
ng extra conditions.<br>That&#39;s why i proposed this break(n). The &quot;=
goto&quot; is not the more desirable to use, either you want dirtier code w=
ith these extra conditions.<br>In fact I proposed the generic break(n), but=
 probably with a break2 and a break3 would be enough, as I said before, wit=
h a higher inner loops you should split it.<br>This way it keeps simpler.<b=
r><br><br><br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: =
1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">2. =
The use of this feature encourages the writing of low-quality code.<br></bl=
ockquote><br>I don&#39;t see this as encouraging low-quality code, this way=
 unnecessary conditions aren&#39;t requiered, keep using the same keyword d=
esigned to break loops, and also do not requieres the goto, which is worse =
and depends on extra label.<br><br><br><blockquote style=3D"margin: 0px 0px=
 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" =
class=3D"gmail_quote">Oh, and there&#39;s another thing that makes your ide=
a problematic. It doesn&#39;t combine well with <a href=3D"http://www.googl=
e.com/url?q=3Dhttp%3A%2F%2Fwg21.link%2FP0082&amp;sa=3DD&amp;sntz=3D1&amp;us=
g=3DAFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg" target=3D"_blank" rel=3D"nofollow">=
the proposal for a &quot;for/else&quot; mechanism</a>.
 What would happen if you use `break(2)` and the inner loop has an=20
`else` clause (or whatever we want to call it)? By limiting `break` to=20
just one loop, we ensure that such a proposal still makes sense.<br></block=
quote><br><br>I didn&#39;t know that proposal, but looks already incompatib=
le by using goto inside isn&#39;t? My proposal isn&#39;t incompatible with =
anything because internally it can be translated to a goto by the compiler.=
<br><br><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/fd2cca88-3a6c-4849-a3ae-0f061bba60ba%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fd2cca88-3a6c-4849-a3ae-0f061bba60ba=
%40isocpp.org</a>.<br />

------=_Part_2657_980104704.1473359110787--

------=_Part_2656_1579459530.1473359110787--

.


Author: szollosi.lorand@gmail.com
Date: Thu, 8 Sep 2016 11:26:18 -0700 (PDT)
Raw View
------=_Part_448_1456273739.1473359178674
Content-Type: multipart/alternative;
 boundary="----=_Part_449_1174031080.1473359178674"

------=_Part_449_1174031080.1473359178674
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi,

Note that this is essentially solved by the idea of 'capturing monads in=20
lambdas'.

Thanks,
-lorro

2016. szeptember 8., cs=C3=BCt=C3=B6rt=C3=B6k 13:54:14 UTC+2 id=C5=91pontba=
n amg...@gmail.com a=20
k=C3=B6vetkez=C5=91t =C3=ADrta:
>
>     In order to exit from a nested loop when a condition is found you nee=
d=20
> to add an extra condition to ckeck in each external loop:
>
>
>     while ( cond1 )
>     {
>         bool found =3D false;
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 found =3D true;
>                 *break;*
>             }
>         }
>
>         if ( found )
>         {=20
>             *break;*
>         }  =20
>     }
>
>
>     *solution 1 ) *elegant but slow to code: declare a new method, move=
=20
> that double bucle to that method and use return
>    =20
>
>     void    test()
>     {
>         while ( cond1 )
>         {
>             while ( cond2 )
>             {
>                 if ( cond3 )
>                 {
> *                    return*;               =20
>                 }
>             }           =20
>         }
>     }
>
>  *   solution 2 *) use goto ( faster to code but uglier style )
>    =20
>    =20
> https://msdn.microsoft.com/en-us/library/b34dt9cd.aspx?f=3D255&MSPPError=
=3D-2147217396
>
>     "It is good programming style to use the break, continue, and return=
=20
> statements instead of the goto statement whenever possible. However,=20
> because the break statement exits from only one level of a loop, you migh=
t=20
> have to use a goto statement to exit a deeply nested loop."
>
>     while ( cond1 )
>     {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {        =20
>                 *goto LabelEndLoops;*
>             }
>         }
>     }
>
> *    LabelEndLoops;*
>
>
>     *solution 3 )* proposal... break( n )
>
>     while ( cond1 )
>     {       =20
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                * break( 2 ); *
>             }
>         }
>     }
>
>     This is very simple to solve by compiler, it just needs to replace=20
> internally by a goto statement.
>
>         *break( 1 )* =3D *break*  exits from 1 loop
>         *break( n )* exits from n loops
>         *break( * )* exits from all loops
>
>     or if you prefer break1, breakN, break* without the parenthesis=20
> instead is also acceptable.
>     ( In case of symbol * cannot be used, it can be replaced by any more=
=20
> convenient. )
>

--=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/83e7d4e7-f202-4258-8666-37cda2eef0db%40isocpp.or=
g.

------=_Part_449_1174031080.1473359178674
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<br><br>Note that this is essentially solved by the ide=
a of &#39;capturing monads in lambdas&#39;.<br><br>Thanks,<br>-lorro<br><br=
>2016. szeptember 8., cs=C3=BCt=C3=B6rt=C3=B6k 13:54:14 UTC+2 id=C5=91pontb=
an amg...@gmail.com a k=C3=B6vetkez=C5=91t =C3=ADrta:<blockquote class=3D"g=
mail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc sol=
id;padding-left: 1ex;"><div dir=3D"ltr">=C2=A0=C2=A0=C2=A0 In order to exit=
 from a nested loop when a condition is found you need to add an extra cond=
ition to ckeck in each external loop:<br><br><br>=C2=A0=C2=A0=C2=A0 while (=
 cond1 )<br>=C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 b=
ool found =3D false;<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 while ( cond2=
 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if ( cond3 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 found =3D true;<br>=C2=A0=C2=A0=C2=A0=
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <span style=3D"co=
lor:rgb(255,0,0)"><b>break;</b></span><br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<br><=
br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if ( found )<br>=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 { <br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 <b><span style=3D"color:rgb(255,0,0)">break;</span=
></b><br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }=C2=A0=C2=A0 <br>=C2=
=A0=C2=A0=C2=A0 }<br><br><br>=C2=A0=C2=A0=C2=A0 <b>solution 1 ) </b>elegant=
 but slow to code: declare a new method, move that double bucle to that met=
hod and use return<br>=C2=A0=C2=A0=C2=A0 <br><br>=C2=A0=C2=A0=C2=A0 void=C2=
=A0=C2=A0=C2=A0 test()<br>=C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 while ( cond1 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 while ( cond2 )<br=
>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if ( cond3 =
)<span style=3D"color:rgb(255,0,0)"><b><br></b><span style=3D"color:rgb(68,=
68,68)">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {</span><b>=
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r=
eturn</b></span>;=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=
=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=
=A0 }<br><br>=C2=A0<b>=C2=A0=C2=A0 solution 2 </b>) use <span style=3D"colo=
r:rgb(255,0,0)">goto</span> ( faster to code but uglier style )<br>=C2=A0=
=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 <a href=3D"https://msdn.microsoft.com/e=
n-us/library/b34dt9cd.aspx?f=3D255&amp;MSPPError=3D-2147217396" target=3D"_=
blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.google.=
com/url?q\x3dhttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fb34dt9cd.=
aspx%3Ff%3D255%26MSPPError%3D-2147217396\x26sa\x3dD\x26sntz\x3d1\x26usg\x3d=
AFQjCNHDYPigZD0Veldxyzvt9GIJyx2yRw&#39;;return true;" onclick=3D"this.href=
=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmsdn.microsoft.com%2F=
en-us%2Flibrary%2Fb34dt9cd.aspx%3Ff%3D255%26MSPPError%3D-2147217396\x26sa\x=
3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDYPigZD0Veldxyzvt9GIJyx2yRw&#39;;return t=
rue;">https://msdn.microsoft.com/en-<wbr>us/library/b34dt9cd.aspx?f=3D<wbr>=
255&amp;MSPPError=3D-2147217396</a><br><br>=C2=A0=C2=A0=C2=A0 &quot;It is g=
ood programming style to use the break, continue, and return statements ins=
tead of the goto statement whenever possible. However, because the break st=
atement exits from only one level of a loop, you might have to use a goto s=
tatement to exit a deeply nested loop.&quot;<br><br>=C2=A0=C2=A0=C2=A0 whil=
e ( cond1 )<br>=C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 while ( cond2 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=
=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if ( cond3 )<br>=C2=A0=C2=
=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {=C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 <span style=3D"color:rgb(255,0,0)"><b>goto LabelE=
ndLoops;</b></span><br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<b><span style=3D"color:=
rgb(255,0,0)"></span></b><br>=C2=A0=C2=A0=C2=A0 }<br><br><span style=3D"col=
or:rgb(255,0,0)"><b>=C2=A0=C2=A0=C2=A0 LabelEndLoops;</b></span><br><br><br=
>=C2=A0=C2=A0=C2=A0<b> </b><span style=3D"color:rgb(0,0,0)"><b>solution 3 )=
</b> </span>proposal...<span style=3D"color:rgb(255,0,0)"> break( n )</span=
><br><br>=C2=A0=C2=A0=C2=A0 while ( cond1 )<br>=C2=A0=C2=A0=C2=A0 {=C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 w=
hile ( cond2 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if ( cond3 )<br>=C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0<b><span style=3D"color:r=
gb(255,0,0)"> break( 2 ); </span></b><br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 =C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<br>=C2=
=A0=C2=A0=C2=A0 }<br><br>=C2=A0=C2=A0=C2=A0 This is very simple to solve by=
 compiler, it just needs to replace internally by a goto statement.<br><br>=
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <b>break( 1 )</b> =3D <b>break</b>=C2=
=A0 exits from 1 loop<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <b>break( n =
)</b> exits from n loops<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <b>break(=
 * )</b> exits from all loops<br><br>=C2=A0=C2=A0=C2=A0 or if you prefer br=
eak1, breakN, break* without the parenthesis instead is also acceptable.<br=
>=C2=A0=C2=A0=C2=A0 ( In case of symbol * cannot be used, it can be replace=
d by any more convenient. )<br></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/83e7d4e7-f202-4258-8666-37cda2eef0db%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/83e7d4e7-f202-4258-8666-37cda2eef0db=
%40isocpp.org</a>.<br />

------=_Part_449_1174031080.1473359178674--

------=_Part_448_1456273739.1473359178674--

.


Author: Larry Evans <cppljevans@suddenlink.net>
Date: Thu, 8 Sep 2016 15:48:36 -0500
Raw View
On 09/08/2016 07:55 AM, amgstc@gmail.com wrote:
> "break" already has a relative meaning, it is relative to current loop.
> This just extends to more than one, no need of labels otherwise we
> already have "goto".
>
>
In http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3879.pdf, the
loop_label in:

   break loop_label;

must label an existing loop; hence, is different than:

   goto statement_label;

where statement_label can label *any* statement.
At least that's how I read section 0.5.1 in n3879.pdf.

-regards,
Larry





--
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/nqsir4%24t0n%241%40blaine.gmane.org.

.


Author: amgstc@gmail.com
Date: Thu, 8 Sep 2016 16:47:29 -0700 (PDT)
Raw View
------=_Part_938_1828696895.1473378449993
Content-Type: multipart/alternative;
 boundary="----=_Part_939_1392843218.1473378449993"

------=_Part_939_1392843218.1473378449993
Content-Type: text/plain; charset=UTF-8

Ok, I just wanted to let know my proposal.

These previous attempts like this "explicit flow control" paper, the
"for/else" proposal, and other posts already discussed, shows that
something should be done to improve the break situation.
Personally I like the break2, break3 solution, and I do not dislike the
"for/else" either because it allows to do connect another break when inner
loop break is detected, with an extra line but with no need of extra
condition or goto.
Also the "for/else" allows the detection when a loop has ended normally or
has been "aborted" which is nice to know aswell.
So I hope something can be done in a future.


That's all. Thank you for the feedback.



On Thursday, September 8, 2016 at 10:49:00 PM UTC+2, Larry Evans wrote:
>
> On 09/08/2016 07:55 AM, amg...@gmail.com <javascript:> wrote:
> > "break" already has a relative meaning, it is relative to current loop.
> > This just extends to more than one, no need of labels otherwise we
> > already have "goto".
> >
> >
> In http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3879.pdf, the
> loop_label in:
>
>    break loop_label;
>
> must label an existing loop; hence, is different than:
>
>    goto statement_label;
>
> where statement_label can label *any* statement.
> At least that's how I read section 0.5.1 in n3879.pdf.
>
> -regards,
> Larry
>
>
>
>
>
>

--
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/7832cbf1-d290-49ea-b7d3-93019e272c75%40isocpp.org.

------=_Part_939_1392843218.1473378449993
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Ok, I just wanted to let know my proposal. <br><br>These p=
revious attempts like this &quot;explicit flow control&quot; paper, the &qu=
ot;for/else&quot; proposal,  and other posts already discussed, shows that =
something should be done to improve the break situation.<br>Personally I li=
ke the break2, break3 solution, and I do not dislike the &quot;for/else&quo=
t; either because it allows to do connect another break when inner loop bre=
ak is detected, with an extra line but with no need of extra condition or g=
oto.<br>Also the &quot;for/else&quot; allows the detection when a loop has =
ended normally or has been &quot;aborted&quot; which is nice to know aswell=
.. <br>So I hope something can be done in a future.<br><br><br>That&#39;s al=
l. Thank you for the feedback.<br><br><br><br>On Thursday, September 8, 201=
6 at 10:49:00 PM UTC+2, Larry Evans wrote:<blockquote class=3D"gmail_quote"=
 style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-=
left: 1ex;">On 09/08/2016 07:55 AM, <a href=3D"javascript:" target=3D"_blan=
k" gdf-obfuscated-mailto=3D"OD3KA_DvFAAJ" rel=3D"nofollow" onmousedown=3D"t=
his.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;=
javascript:&#39;;return true;">amg...@gmail.com</a> wrote:
<br>&gt; &quot;break&quot; already has a relative meaning, it is relative t=
o current loop.
<br>&gt; This just extends to more than one, no need of labels otherwise we
<br>&gt; already have &quot;goto&quot;.
<br>&gt;
<br>&gt;
<br>In <a href=3D"http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3879=
..pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;ht=
tp://www.google.com/url?q\x3dhttp%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2FWG21=
%2Fdocs%2Fpapers%2F2014%2Fn3879.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjC=
NGD8xo9EHswUmNbTIaSaBhcm9v1Fg&#39;;return true;" onclick=3D"this.href=3D&#3=
9;http://www.google.com/url?q\x3dhttp%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2F=
WG21%2Fdocs%2Fpapers%2F2014%2Fn3879.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dA=
FQjCNGD8xo9EHswUmNbTIaSaBhcm9v1Fg&#39;;return true;">http://open-std.org/JT=
C1/SC22/<wbr>WG21/docs/papers/2014/n3879.<wbr>pdf</a>, the=20
<br>loop_label in:
<br>
<br>=C2=A0 =C2=A0break loop_label;
<br>
<br>must label an existing loop; hence, is different than:
<br>
<br>=C2=A0 =C2=A0goto statement_label;
<br>
<br>where statement_label can label *any* statement.
<br>At least that&#39;s how I read section 0.5.1 in n3879.pdf.
<br>
<br>-regards,
<br>Larry
<br>
<br>
<br>
<br>
<br>
<br></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/7832cbf1-d290-49ea-b7d3-93019e272c75%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7832cbf1-d290-49ea-b7d3-93019e272c75=
%40isocpp.org</a>.<br />

------=_Part_939_1392843218.1473378449993--

------=_Part_938_1828696895.1473378449993--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 8 Sep 2016 20:46:03 -0700 (PDT)
Raw View
------=_Part_1709_858782739.1473392763553
Content-Type: multipart/alternative;
 boundary="----=_Part_1710_976772036.1473392763554"

------=_Part_1710_976772036.1473392763554
Content-Type: text/plain; charset=UTF-8

On Thursday, September 8, 2016 at 2:25:11 PM UTC-4, amg...@gmail.com wrote:
>
> Finding a `goto` label is done via a simple string search. A good IDE can
>> give it to you by simply right-clicking and picking a menu-item, or with a
>> keyboard shortcut. Finding where `break 2` goes require finding the two
>> nearest loops, which may be off-screen.
>
>
> Well, this is going to a too much more complicated issue that it started.
> If you see my initial example, it is very simple, you do not need a 3 page
> code to make use of it. What I mean is, if the code containing the inner
> loops is complex enough you *should *split that code into another method
> containing the loops, and this way you solve both: the break will be
> replaced by a return, and the complexity of the method will decrease by
> splling it.
>
> But, as my example, if code is small enough due to inner code loops are
> simple, you want a clean and fast exit. Splitting the method is discarded
> in this case, so you only can use the goto or adding extra conditions.
>

So, we restricting the use of this feature to times when you have multiple
loops, but they're small enough to fit on one screen. If that's the case,
then a `goto` is just as good as `break(X)`. In both cases, you can see on
one screen exactly where you will go.

So even in the best possible scenario, your `break(X)` isn't *better* than
a `goto`. Your primary argument seems to be one of taste, of simply
preferring `break` over `goto`.

Oh, and there's another thing that makes your idea problematic. It doesn't
>> combine well with the proposal for a "for/else" mechanism
>> <http://www.google.com/url?q=http%3A%2F%2Fwg21.link%2FP0082&sa=D&sntz=1&usg=AFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg>.
>> What would happen if you use `break(2)` and the inner loop has an `else`
>> clause (or whatever we want to call it)? By limiting `break` to just one
>> loop, we ensure that such a proposal still makes sense.
>>
>
>
> I didn't know that proposal, but looks already incompatible by using goto
> inside isn't? My proposal isn't incompatible with anything because
> internally it can be translated to a goto by the compiler.
>

`goto` is incompatible with that, of course. But it's not *supposed* to be
compatible with it. Using it bypasses control flow; that's the point.

By contrast, the use of the `break` keyword is *supposed* to trigger the
else/catch break/whatever clause. So if you use a multi-level break, but
the inner loop that has an else/catch break/whatever clause... how does
that work? Do you execute the else block or not? If you do, then what
happens at the end of the block? If you don't execute the block, then that
would seem to obviate the whole point of the for/else construct, which
explicitly allows you to catch break instructions and handle them.

--
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/48de6931-d8b0-442d-b85c-efd5c08fe6a0%40isocpp.org.

------=_Part_1710_976772036.1473392763554
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, September 8, 2016 at 2:25:11 PM UTC-4, amg...=
@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><blockquote style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb=
(204,204,204);padding-left:1ex" class=3D"gmail_quote">Finding
 a `goto` label is done via a simple string search. A good IDE can give=20
it to you by simply right-clicking and picking a menu-item, or with a=20
keyboard shortcut. Finding where `break
 2` goes require finding the two nearest loops, which may be off-screen.</b=
lockquote><div><br>Well, this is going to a too much more complicated issue=
 that it started. If you see my initial example, it is very simple, you do =
not need a 3 page code to make use of it. What I mean is, if the code conta=
ining the inner loops is complex enough you <b>should </b>split that code i=
nto another method containing the loops, and this way you solve both: the b=
reak will be replaced by a return, and the complexity of the method will de=
crease by splling it.<br><br>But, as my example, if code is small enough du=
e to inner code loops are simple, you want a clean and fast exit. Splitting=
 the method is discarded in this case, so you only can use the goto or addi=
ng extra conditions.</div></div></blockquote><div><br>So, we restricting th=
e use of this feature to times when you have multiple loops, but they&#39;r=
e small enough to fit on one screen. If that&#39;s the case, then a `goto` =
is just as good as `break(X)`. In both cases, you can see on one screen exa=
ctly where you will go.<br><br>So even in the best possible scenario, your =
`break(X)` isn&#39;t <i>better</i> than a `goto`. Your primary argument see=
ms to be one of taste, of simply preferring `break` over `goto`.<br><br></d=
iv><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></div=
></div></blockquote><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"ltr"><div><blockquote style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
 solid rgb(204,204,204);padding-left:1ex" class=3D"gmail_quote">Oh, and the=
re&#39;s another thing that makes your idea problematic. It doesn&#39;t com=
bine well with <a href=3D"http://www.google.com/url?q=3Dhttp%3A%2F%2Fwg21.l=
ink%2FP0082&amp;sa=3DD&amp;sntz=3D1&amp;usg=3DAFQjCNHdI_3wotqZREuL6fuPQaRLk=
rFYGg" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39;h=
ttp://www.google.com/url?q\x3dhttp%3A%2F%2Fwg21.link%2FP0082\x26sa\x3dD\x26=
sntz\x3d1\x26usg\x3dAFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg&#39;;return true;" o=
nclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwg21=
..link%2FP0082\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHdI_3wotqZREuL6fuPQaR=
LkrFYGg&#39;;return true;">the proposal for a &quot;for/else&quot; mechanis=
m</a>.
 What would happen if you use `break(2)` and the inner loop has an=20
`else` clause (or whatever we want to call it)? By limiting `break` to=20
just one loop, we ensure that such a proposal still makes sense.<br></block=
quote><br><br>I didn&#39;t know that proposal, but looks already incompatib=
le by using goto inside isn&#39;t? My proposal isn&#39;t incompatible with =
anything because internally it can be translated to a goto by the compiler.=
<br></div></div></blockquote><div><br>`goto` is incompatible with that, of =
course. But it&#39;s not <i>supposed</i> to be compatible with it. Using it=
 bypasses control flow; that&#39;s the point.<br><br>By contrast, the use o=
f the `break` keyword is <i>supposed</i> to trigger the else/catch break/wh=
atever clause. So if you use a multi-level break, but the inner loop that h=
as an else/catch break/whatever clause... how does that work? Do you execut=
e the else block or not? If you do, then what happens at the end of the blo=
ck? If you don&#39;t execute the block, then that would seem to obviate the=
 whole point of the for/else construct, which explicitly allows you to catc=
h break instructions and handle them.<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/48de6931-d8b0-442d-b85c-efd5c08fe6a0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/48de6931-d8b0-442d-b85c-efd5c08fe6a0=
%40isocpp.org</a>.<br />

------=_Part_1710_976772036.1473392763554--

------=_Part_1709_858782739.1473392763553--

.


Author: FrankHB1989 <frankhb1989@gmail.com>
Date: Thu, 8 Sep 2016 21:09:42 -0700 (PDT)
Raw View
------=_Part_5190_1075083274.1473394182913
Content-Type: multipart/alternative;
 boundary="----=_Part_5191_1409730164.1473394182914"

------=_Part_5191_1409730164.1473394182914
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



=E5=9C=A8 2016=E5=B9=B49=E6=9C=889=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=94 UTC+=
8=E4=B8=8A=E5=8D=881:39:39=EF=BC=8CNicol Bolas=E5=86=99=E9=81=93=EF=BC=9A
>
> On Thursday, September 8, 2016 at 10:36:05 AM UTC-4, amg...@gmail.com=20
> wrote:
>>
>> Problem is these cases are not so rare. Everything that is composed of=
=20
>> more than 1 dimension, like images, databases, matrixes, etc, requieres =
2=20
>> or more loops to apply most of algorithms to them ( usually everything=
=20
>> composed of row and columns )
>> for example: to search for an element and abort when the condition is=20
>> found. There is a lot of algorithms than needs to deal with mutliple=20
>> dimensional objects, so this situation is a lot more frequent than expec=
ted.
>>
>
> That sounds like a good reason to have a multidimensional iterator type s=
o=20
> that you can use `find_if`, not a first-class language feature.
>
> And as you mention later, yes, there are other scenarios that cannot be=
=20
> handled by a generic algorithm, even with a multi-dimensional iterator. B=
ut=20
> again, such scenarios are so rare (made even moreso with multidimensional=
=20
> iterators) that they're not worth adding a language feature to solve them=
..=20
> Not so long as we already have a language feature that can handle it=20
> adequately.
>
> Anyway this not about replacing goto, anyone can keep using it, though=20
>> similar problems you describes applies to goto too:
>> If algorithm is modified or adjusted it may requiere the label to be=20
>> moved, otherwise algorithm will fail aswell.=20
>> If I do break( 2 ) i know exactly how many loops I exit. If I do a goto,=
=20
>> can be anywhere in the method, even in previous lines, so finding where=
=20
>> label is located can be even harder.
>>
>
> Finding a `goto` label is done via a simple string search. A good IDE can=
=20
> give it to you by simply right-clicking and picking a menu-item, or with =
a=20
> keyboard shortcut. Finding where `break 2` goes require finding the two=
=20
> nearest loops, which may be off-screen.
>
> On Thursday, September 8, 2016 at 11:59:09 AM UTC-4, amg...@gmail.com=20
> wrote:
>>
>> You probably didn't realize that c++ break is already relative, it exits=
=20
>> from the current loop level. Where it exits? relative to the size of the=
=20
>> loop where you put the break. If the loop would have 1 thousand lines, i=
t=20
>> would jump at the end to that code length.=20
>> 'break' behaviour is very useful, so this break(n) extension is not=20
>> different.=20
>>
>
> You can't just say that your feature is just as good as another, more=20
> narrow feature, just because it does what the narrow feature does too.
>
> `break` is tolerated precisely *because* it is narrow. It has its=20
> fragilities, but doing a single jump out of a loop solves more problems=
=20
> than it causes. The problems that `break(X)` solve are so rare that they'=
re=20
> not worth the problems that having such a feature will cause.
>
> And let's be clear and practical, how many nested loops do we have? 1, 2,=
=20
>> ... 3? other than that we split in other method, so we are not going to =
use=20
>> break( 17 ), aswell we can place one thousand goto's in a method but nob=
ody=20
>> does it.
>>
>
> ... You seem to be arguing *against* your own feature. If you genuinely=
=20
> only have 2 or 3 dimensions on such loops, then *what's the point* of=20
> this "break-by-number" functionality?
>
> break(n) is useful, clear, requieres no extra conditional check or define=
=20
>> extra label like goto, and it is easy to implement by compiler. It can b=
e=20
>> translated with an internal goto, but transparent and safe, aswell it do=
es=20
>> with the usual jumps in conditionals "if/else", "for", "do / while", etc
>>
> =20
>>
> And the most important, it is* optional*, you can use it or not.
>>
>
> Every language feature has a cost. It costs times for the committee to=20
> evaluate and standardize a proposal. It costs compiler writers time to=20
> implement it. It costs teaching time when users unfamiliar with it ask=20
> about it.
>
> Whether you personally use a language feature or not, you will still pay=
=20
> these costs.
>
> As such, any language feature must provide sufficient benefit, broadly, t=
o=20
> be worth that cost. To me, your proposal fails in two areas:
>
> 1. The amount of code that would benefit from its use is not significant=
=20
> enough to be worth the costs of having it as a feature. While the existin=
g=20
> solutions are not ideal, they are *adequate* for those times when the=20
> problem arises.
>
> 2. The use of this feature encourages the writing of low-quality code.
>
> Oh, and there's another thing that makes your idea problematic. It doesn'=
t=20
> combine well with the proposal for a "for/else" mechanism=20
> <http://www.google.com/url?q=3Dhttp%3A%2F%2Fwg21.link%2FP0082&sa=3DD&sntz=
=3D1&usg=3DAFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg>.=20
> What would happen if you use `break(2)` and the inner loop has an `else`=
=20
> clause (or whatever we want to call it)? By limiting `break` to just one=
=20
> loop, we ensure that such a proposal still makes sense.
>
It sounds like we'd better have more powerful control primitives (e.g.=20
delimited continuations) so all these proposals can be implemented as=20
library features... with less disputations, probably.

It would also be interesting to replace all current control keywords=20
(including `return` and `try`/`catch`) with simpler (in sense of=20
specification) primitives portably.


--=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/2fc6d34d-84bc-408f-8051-10ef2f08d595%40isocpp.or=
g.

------=_Part_5191_1409730164.1473394182914
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>=E5=9C=A8 2016=E5=B9=B49=E6=9C=889=E6=97=A5=E6=98=
=9F=E6=9C=9F=E4=BA=94 UTC+8=E4=B8=8A=E5=8D=881:39:39=EF=BC=8CNicol Bolas=E5=
=86=99=E9=81=93=EF=BC=9A<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr">On Thursday, September 8, 2016 at 10:36:05 AM UTC-4, <a>amg...@g=
mail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;marg=
in-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"=
>Problem is these cases are not so rare. Everything that is composed of=20
more than 1 dimension, like images, databases, matrixes, etc, requieres 2
 or more loops to apply most of algorithms to them ( usually everything=20
composed of row and columns )<br>for example: to search for an element=20
and abort when the condition is found. There is a lot of algorithms than
 needs to deal with mutliple dimensional objects, so this situation is a
 lot more frequent than expected.<br></div></blockquote><div><br>That=20
sounds like a good reason to have a multidimensional iterator type so=20
that you can use `find_if`, not a first-class language feature.<br><br>And
 as you mention later, yes, there are other scenarios that cannot be=20
handled by a generic algorithm, even with a multi-dimensional iterator.=20
But again, such scenarios are so rare (made even moreso with multidimension=
al iterators) that they&#39;re not worth adding a=20
language feature to solve them. Not so long as we already have a=20
language feature that can handle it adequately.<br><br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr">Anyway this not about replacing =
goto, anyone can keep using it, though similar problems you describes appli=
es to goto too:<br>If algorithm is modified or adjusted it may requiere the=
 label to be moved, otherwise algorithm will fail aswell. <br>If
 I do break( 2 ) i know exactly how many loops I exit. If I do a goto,=20
can be anywhere in the method, even in previous lines, so finding where=20
label is located can be even harder.<br></div></blockquote><div><br>Finding
 a `goto` label is done via a simple string search. A good IDE can give it =
to you by simply right-clicking and picking a menu-item, or with a keyboard=
 shortcut. Finding where `break
 2` goes require finding the two nearest loops, which may be off-screen.<br=
><br></div>On Thursday, September 8, 2016 at 11:59:09 AM UTC-4, <a>amg...@g=
mail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;marg=
in-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"=
>You probably didn&#39;t realize that c++ break is already relative, it exi=
ts
 from the current loop level. Where it exits? relative to the size of the=
=20
loop where you put the break. If the loop would have 1 thousand lines, it w=
ould jump at the end to that code length. <br>&#39;break&#39; behaviour is =
very useful, so this break(n) extension is not different. <br></div></block=
quote><div><br>You can&#39;t just say that your feature is just as good as =
another, more narrow feature, just because it does what the narrow feature =
does too.<br><br>`break` is tolerated precisely <i>because</i> it is narrow=
.. It has its fragilities, but doing a single jump out of a loop solves more=
 problems than it causes. The problems that `break(X)` solve are so rare th=
at they&#39;re not worth the problems that having such a feature will cause=
..<br><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-l=
eft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">And=
 let&#39;s be clear and practical, how many nested loops do we have? 1, 2, =
.... 3? other than that we split in other method, so we are not going to use=
 break( 17 ), aswell we can place one thousand goto&#39;s in a method but n=
obody does it.<br></div></blockquote><div><br>... You seem to be arguing <i=
>against</i> your own feature. If you genuinely only have 2 or 3 dimensions=
 on such loops, then <i>what&#39;s the point</i> of this &quot;break-by-num=
ber&quot; functionality?<br><br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1e=
x"><div dir=3D"ltr">break(n) is useful, clear, requieres no extra condition=
al check or define extra label like goto, and it is easy to implement by co=
mpiler. It can be translated with an internal goto, but transparent and saf=
e, aswell it does with the usual jumps in conditionals &quot;if/else&quot;,=
 &quot;for&quot;, &quot;do / while&quot;, etc<br></div></blockquote><blockq=
uote style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex" class=3D"gmail_quote"><div>=C2=A0</div></blockquote><b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">And the most importa=
nt, it is<b> optional</b>, you can use it or not.<br></div></blockquote><di=
v><br>Every language feature has a cost. It costs times for the committee t=
o evaluate and standardize a proposal. It costs compiler writers time to im=
plement it. It costs teaching time when users unfamiliar with it ask about =
it.<br><br>Whether you personally use a language feature or not, you will s=
till pay these costs.<br><br>As such, any language feature must provide suf=
ficient benefit, broadly, to be worth that cost. To me, your proposal fails=
 in two areas:<br><br>1. The amount of code that would benefit from its use=
 is not significant enough to be worth the costs of having it as a feature.=
 While the existing solutions are not ideal, they are <i>adequate</i> for t=
hose times when the problem arises.<br><br>2. The use of this feature encou=
rages the writing of low-quality code.<br><br>Oh, and there&#39;s another t=
hing that makes your idea problematic. It doesn&#39;t combine well with <a =
href=3D"http://www.google.com/url?q=3Dhttp%3A%2F%2Fwg21.link%2FP0082&amp;sa=
=3DD&amp;sntz=3D1&amp;usg=3DAFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg" target=3D"_=
blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.c=
om/url?q\x3dhttp%3A%2F%2Fwg21.link%2FP0082\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg&#39;;return true;" onclick=3D"this.hre=
f=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwg21.link%2FP0082\x26s=
a\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg&#39;;retur=
n true;">the proposal for a &quot;for/else&quot; mechanism</a>. What would =
happen if you use `break(2)` and the inner loop has an `else` clause (or wh=
atever we want to call it)? By limiting `break` to just one loop, we ensure=
 that such a proposal still makes sense.<br></div></div></blockquote><div>I=
t sounds like we&#39;d better have more powerful control primitives (e.g. d=
elimited continuations) so all these proposals can be implemented as librar=
y features... with less disputations, probably.<br><br>It would also be int=
eresting to replace all current control keywords (including `return` and `t=
ry`/`catch`) with simpler (in sense of specification) primitives portably.<=
br><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/2fc6d34d-84bc-408f-8051-10ef2f08d595%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2fc6d34d-84bc-408f-8051-10ef2f08d595=
%40isocpp.org</a>.<br />

------=_Part_5191_1409730164.1473394182914--

------=_Part_5190_1075083274.1473394182913--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Fri, 9 Sep 2016 09:09:31 -0400
Raw View
--94eb2c042f4e9ad418053c12dc9b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Given my endless arguing in the order-of-evaluation threads, I have really
come to hate the "promotes bad code" arguments.  The proof that *break
Label;* is good is that Ada has it.  And by the way, have none of the "bad
code" arguers ever had to exit a *for* loop from inside a *switch*
statement?

On Fri, Sep 9, 2016 at 12:09 AM, FrankHB1989 <frankhb1989@gmail.com> wrote:

>
>
> =E5=9C=A8 2016=E5=B9=B49=E6=9C=889=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=94 UT=
C+8=E4=B8=8A=E5=8D=881:39:39=EF=BC=8CNicol Bolas=E5=86=99=E9=81=93=EF=BC=9A
>>
>> On Thursday, September 8, 2016 at 10:36:05 AM UTC-4, amg...@gmail.com
>> wrote:
>>>
>>> Problem is these cases are not so rare. Everything that is composed of
>>> more than 1 dimension, like images, databases, matrixes, etc, requieres=
 2
>>> or more loops to apply most of algorithms to them ( usually everything
>>> composed of row and columns )
>>> for example: to search for an element and abort when the condition is
>>> found. There is a lot of algorithms than needs to deal with mutliple
>>> dimensional objects, so this situation is a lot more frequent than expe=
cted.
>>>
>>
>> That sounds like a good reason to have a multidimensional iterator type
>> so that you can use `find_if`, not a first-class language feature.
>>
>> And as you mention later, yes, there are other scenarios that cannot be
>> handled by a generic algorithm, even with a multi-dimensional iterator. =
But
>> again, such scenarios are so rare (made even moreso with multidimensiona=
l
>> iterators) that they're not worth adding a language feature to solve the=
m.
>> Not so long as we already have a language feature that can handle it
>> adequately.
>>
>> Anyway this not about replacing goto, anyone can keep using it, though
>>> similar problems you describes applies to goto too:
>>> If algorithm is modified or adjusted it may requiere the label to be
>>> moved, otherwise algorithm will fail aswell.
>>> If I do break( 2 ) i know exactly how many loops I exit. If I do a goto=
,
>>> can be anywhere in the method, even in previous lines, so finding where
>>> label is located can be even harder.
>>>
>>
>> Finding a `goto` label is done via a simple string search. A good IDE ca=
n
>> give it to you by simply right-clicking and picking a menu-item, or with=
 a
>> keyboard shortcut. Finding where `break 2` goes require finding the two
>> nearest loops, which may be off-screen.
>>
>> On Thursday, September 8, 2016 at 11:59:09 AM UTC-4, amg...@gmail.com
>> wrote:
>>>
>>> You probably didn't realize that c++ break is already relative, it exit=
s
>>> from the current loop level. Where it exits? relative to the size of th=
e
>>> loop where you put the break. If the loop would have 1 thousand lines, =
it
>>> would jump at the end to that code length.
>>> 'break' behaviour is very useful, so this break(n) extension is not
>>> different.
>>>
>>
>> You can't just say that your feature is just as good as another, more
>> narrow feature, just because it does what the narrow feature does too.
>>
>> `break` is tolerated precisely *because* it is narrow. It has its
>> fragilities, but doing a single jump out of a loop solves more problems
>> than it causes. The problems that `break(X)` solve are so rare that they=
're
>> not worth the problems that having such a feature will cause.
>>
>> And let's be clear and practical, how many nested loops do we have? 1, 2=
,
>>> ... 3? other than that we split in other method, so we are not going to=
 use
>>> break( 17 ), aswell we can place one thousand goto's in a method but no=
body
>>> does it.
>>>
>>
>> ... You seem to be arguing *against* your own feature. If you genuinely
>> only have 2 or 3 dimensions on such loops, then *what's the point* of
>> this "break-by-number" functionality?
>>
>> break(n) is useful, clear, requieres no extra conditional check or defin=
e
>>> extra label like goto, and it is easy to implement by compiler. It can =
be
>>> translated with an internal goto, but transparent and safe, aswell it d=
oes
>>> with the usual jumps in conditionals "if/else", "for", "do / while", et=
c
>>>
>>
>>>
>> And the most important, it is* optional*, you can use it or not.
>>>
>>
>> Every language feature has a cost. It costs times for the committee to
>> evaluate and standardize a proposal. It costs compiler writers time to
>> implement it. It costs teaching time when users unfamiliar with it ask
>> about it.
>>
>> Whether you personally use a language feature or not, you will still pay
>> these costs.
>>
>> As such, any language feature must provide sufficient benefit, broadly,
>> to be worth that cost. To me, your proposal fails in two areas:
>>
>> 1. The amount of code that would benefit from its use is not significant
>> enough to be worth the costs of having it as a feature. While the existi=
ng
>> solutions are not ideal, they are *adequate* for those times when the
>> problem arises.
>>
>> 2. The use of this feature encourages the writing of low-quality code.
>>
>> Oh, and there's another thing that makes your idea problematic. It
>> doesn't combine well with the proposal for a "for/else" mechanism
>> <http://www.google.com/url?q=3Dhttp%3A%2F%2Fwg21.link%2FP0082&sa=3DD&snt=
z=3D1&usg=3DAFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg>.
>> What would happen if you use `break(2)` and the inner loop has an `else`
>> clause (or whatever we want to call it)? By limiting `break` to just one
>> loop, we ensure that such a proposal still makes sense.
>>
> It sounds like we'd better have more powerful control primitives (e.g.
> delimited continuations) so all these proposals can be implemented as
> library features... with less disputations, probably.
>
> It would also be interesting to replace all current control keywords
> (including `return` and `try`/`catch`) with simpler (in sense of
> specification) primitives portably.
>
>
> --
> 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/2fc6d34d-84bc-408f-
> 8051-10ef2f08d595%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/2fc6d34d-84=
bc-408f-8051-10ef2f08d595%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/CAHSYqdZMkzEf0Fk2hELmed_yAn6QTr5dLZ2rK6wDcLJCgsB=
FRw%40mail.gmail.com.

--94eb2c042f4e9ad418053c12dc9b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Given my endless arguing in the order-of-evaluation thread=
s, I have really come to hate the &quot;promotes bad code&quot; arguments.=
=C2=A0 The proof that <font face=3D"monospace, monospace"><b>break <i>Label=
</i>;</b></font> is good is that Ada has it.=C2=A0 And by the way, have non=
e of the &quot;bad code&quot; arguers ever had to exit a <font face=3D"comi=
c sans ms, sans-serif"><b>for</b></font> loop from inside a <font face=3D"m=
onospace, monospace"><b>switch</b></font> statement?</div><div class=3D"gma=
il_extra"><br><div class=3D"gmail_quote">On Fri, Sep 9, 2016 at 12:09 AM, F=
rankHB1989 <span dir=3D"ltr">&lt;<a href=3D"mailto:frankhb1989@gmail.com" t=
arget=3D"_blank">frankhb1989@gmail.com</a>&gt;</span> wrote:<br><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"><br><br>=E5=9C=A8 2016=E5=B9=B49=E6=9C=
=889=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=94 UTC+8=E4=B8=8A=E5=8D=881:39:39=EF=
=BC=8CNicol Bolas=E5=86=99=E9=81=93=EF=BC=9A<span class=3D""><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr">On Thursday, September 8, 2016 a=
t 10:36:05 AM UTC-4, <a>amg...@gmail.com</a> wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div dir=3D"ltr">Problem is these cases are not so rare. Ev=
erything that is composed of=20
more than 1 dimension, like images, databases, matrixes, etc, requieres 2
 or more loops to apply most of algorithms to them ( usually everything=20
composed of row and columns )<br>for example: to search for an element=20
and abort when the condition is found. There is a lot of algorithms than
 needs to deal with mutliple dimensional objects, so this situation is a
 lot more frequent than expected.<br></div></blockquote><div><br>That=20
sounds like a good reason to have a multidimensional iterator type so=20
that you can use `find_if`, not a first-class language feature.<br><br>And
 as you mention later, yes, there are other scenarios that cannot be=20
handled by a generic algorithm, even with a multi-dimensional iterator.=20
But again, such scenarios are so rare (made even moreso with multidimension=
al iterators) that they&#39;re not worth adding a=20
language feature to solve them. Not so long as we already have a=20
language feature that can handle it adequately.<br><br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr">Anyway this not about replacing =
goto, anyone can keep using it, though similar problems you describes appli=
es to goto too:<br>If algorithm is modified or adjusted it may requiere the=
 label to be moved, otherwise algorithm will fail aswell. <br>If
 I do break( 2 ) i know exactly how many loops I exit. If I do a goto,=20
can be anywhere in the method, even in previous lines, so finding where=20
label is located can be even harder.<br></div></blockquote><div><br>Finding
 a `goto` label is done via a simple string search. A good IDE can give it =
to you by simply right-clicking and picking a menu-item, or with a keyboard=
 shortcut. Finding where `break
 2` goes require finding the two nearest loops, which may be off-screen.<br=
><br></div>On Thursday, September 8, 2016 at 11:59:09 AM UTC-4, <a>amg...@g=
mail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;marg=
in-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"=
>You probably didn&#39;t realize that c++ break is already relative, it exi=
ts
 from the current loop level. Where it exits? relative to the size of the=
=20
loop where you put the break. If the loop would have 1 thousand lines, it w=
ould jump at the end to that code length. <br>&#39;break&#39; behaviour is =
very useful, so this break(n) extension is not different. <br></div></block=
quote><div><br>You can&#39;t just say that your feature is just as good as =
another, more narrow feature, just because it does what the narrow feature =
does too.<br><br>`break` is tolerated precisely <i>because</i> it is narrow=
.. It has its fragilities, but doing a single jump out of a loop solves more=
 problems than it causes. The problems that `break(X)` solve are so rare th=
at they&#39;re not worth the problems that having such a feature will cause=
..<br><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-l=
eft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">And=
 let&#39;s be clear and practical, how many nested loops do we have? 1, 2, =
.... 3? other than that we split in other method, so we are not going to use=
 break( 17 ), aswell we can place one thousand goto&#39;s in a method but n=
obody does it.<br></div></blockquote><div><br>... You seem to be arguing <i=
>against</i> your own feature. If you genuinely only have 2 or 3 dimensions=
 on such loops, then <i>what&#39;s the point</i> of this &quot;break-by-num=
ber&quot; functionality?<br><br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1e=
x"><div dir=3D"ltr">break(n) is useful, clear, requieres no extra condition=
al check or define extra label like goto, and it is easy to implement by co=
mpiler. It can be translated with an internal goto, but transparent and saf=
e, aswell it does with the usual jumps in conditionals &quot;if/else&quot;,=
 &quot;for&quot;, &quot;do / while&quot;, etc<br></div></blockquote><blockq=
uote style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex" class=3D"gmail_quote"><div>=C2=A0</div></blockquote><b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">And the most importa=
nt, it is<b> optional</b>, you can use it or not.<br></div></blockquote><di=
v><br>Every language feature has a cost. It costs times for the committee t=
o evaluate and standardize a proposal. It costs compiler writers time to im=
plement it. It costs teaching time when users unfamiliar with it ask about =
it.<br><br>Whether you personally use a language feature or not, you will s=
till pay these costs.<br><br>As such, any language feature must provide suf=
ficient benefit, broadly, to be worth that cost. To me, your proposal fails=
 in two areas:<br><br>1. The amount of code that would benefit from its use=
 is not significant enough to be worth the costs of having it as a feature.=
 While the existing solutions are not ideal, they are <i>adequate</i> for t=
hose times when the problem arises.<br><br>2. The use of this feature encou=
rages the writing of low-quality code.<br><br>Oh, and there&#39;s another t=
hing that makes your idea problematic. It doesn&#39;t combine well with <a =
href=3D"http://www.google.com/url?q=3Dhttp%3A%2F%2Fwg21.link%2FP0082&amp;sa=
=3DD&amp;sntz=3D1&amp;usg=3DAFQjCNHdI_3wotqZREuL6fuPQaRLkrFYGg" rel=3D"nofo=
llow" target=3D"_blank">the proposal for a &quot;for/else&quot; mechanism</=
a>. What would happen if you use `break(2)` and the inner loop has an `else=
` clause (or whatever we want to call it)? By limiting `break` to just one =
loop, we ensure that such a proposal still makes sense.<br></div></div></bl=
ockquote></span><div>It sounds like we&#39;d better have more powerful cont=
rol primitives (e.g. delimited continuations) so all these proposals can be=
 implemented as library features... with less disputations, probably.<br><b=
r>It would also be interesting to replace all current control keywords (inc=
luding `return` and `try`/`catch`) with simpler (in sense of specification)=
 primitives portably.<br><br><br></div></div><span class=3D"">

<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@<wbr>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></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2fc6d34d-84bc-408f-8051-10ef2f08d595%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/2fc6=
d34d-84bc-408f-<wbr>8051-10ef2f08d595%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></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/CAHSYqdZMkzEf0Fk2hELmed_yAn6QTr5dLZ2r=
K6wDcLJCgsBFRw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdZMkzEf0Fk2=
hELmed_yAn6QTr5dLZ2rK6wDcLJCgsBFRw%40mail.gmail.com</a>.<br />

--94eb2c042f4e9ad418053c12dc9b--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 9 Sep 2016 16:55:40 +0300
Raw View
On 9 September 2016 at 16:09, Hyman Rosen <hyman.rosen@gmail.com> wrote:
> Given my endless arguing in the order-of-evaluation threads, I have really
> come to hate the "promotes bad code" arguments.  The proof that break Label;
> is good is that Ada has it.  And by the way, have none of the "bad code"
> arguers ever had to exit a for loop from inside a switch statement?


Not after writing the code to be less bad, i.e. not to contain a for
loop inside a switch statement.
I tend not to nest loops, and especially not to nest loops under
selection statements.

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

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 9 Sep 2016 16:56:40 +0300
Raw View
On 9 September 2016 at 16:55, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> On 9 September 2016 at 16:09, Hyman Rosen <hyman.rosen@gmail.com> wrote:
>> Given my endless arguing in the order-of-evaluation threads, I have really
>> come to hate the "promotes bad code" arguments.  The proof that break Label;
>> is good is that Ada has it.  And by the way, have none of the "bad code"
>> arguers ever had to exit a for loop from inside a switch statement?
>
>
> Not after writing the code to be less bad, i.e. not to contain a for
> loop inside a switch statement.
> I tend not to nest loops, and especially not to nest loops under
> selection statements.

Also, your very nice "proof" from Ada is nullified by Java also having
a break Label, which means
that it can't be good. Your move.

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

.


Author: Greg Marr <gregmmarr@gmail.com>
Date: Fri, 9 Sep 2016 07:13:20 -0700 (PDT)
Raw View
------=_Part_1757_1244096135.1473430401295
Content-Type: multipart/alternative;
 boundary="----=_Part_1758_106144689.1473430401295"

------=_Part_1758_106144689.1473430401295
Content-Type: text/plain; charset=UTF-8

On Friday, September 9, 2016 at 9:55:43 AM UTC-4, Ville Voutilainen wrote:
>
> On 9 September 2016 at 16:09, Hyman Rosen <hyman...@gmail.com
> <javascript:>> wrote:
> > Given my endless arguing in the order-of-evaluation threads, I have
> really
> > come to hate the "promotes bad code" arguments.  The proof that break
> Label;
> > is good is that Ada has it.  And by the way, have none of the "bad code"
> > arguers ever had to exit a for loop from inside a switch statement?
>
> Not after writing the code to be less bad, i.e. not to contain a for
> loop inside a switch statement.
> I tend not to nest loops, and especially not to nest loops under
> selection statements.
>

I believe you read that backwards.  The switch is inside the 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/a4612964-848c-4901-bd06-58a45ed8cd3d%40isocpp.org.

------=_Part_1758_106144689.1473430401295
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, September 9, 2016 at 9:55:43 AM UTC-4, Ville Vo=
utilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 9 September=
 2016 at 16:09, Hyman Rosen &lt;<a href=3D"javascript:" target=3D"_blank" g=
df-obfuscated-mailto=3D"9xWNEvcnFQAJ" rel=3D"nofollow" onmousedown=3D"this.=
href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;java=
script:&#39;;return true;">hyman...@gmail.com</a>&gt; wrote:
<br>&gt; Given my endless arguing in the order-of-evaluation threads, I hav=
e really
<br>&gt; come to hate the &quot;promotes bad code&quot; arguments. =C2=A0Th=
e proof that break Label;
<br>&gt; is good is that Ada has it. =C2=A0And by the way, have none of the=
 &quot;bad code&quot;
<br>&gt; arguers ever had to exit a for loop from inside a switch statement=
?
<br><br>Not after writing the code to be less bad, i.e. not to contain a fo=
r
<br>loop inside a switch statement.
<br>I tend not to nest loops, and especially not to nest loops under
<br>selection statements.
<br></blockquote><div><br></div><div>I believe you read that backwards. =C2=
=A0The switch is inside the for.</div><div><br></div></div>

<p></p>

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

------=_Part_1758_106144689.1473430401295--

------=_Part_1757_1244096135.1473430401295--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 9 Sep 2016 17:20:54 +0300
Raw View
On 9 September 2016 at 17:13, Greg Marr <gregmmarr@gmail.com> wrote:
> On Friday, September 9, 2016 at 9:55:43 AM UTC-4, Ville Voutilainen wrote:
>>
>> On 9 September 2016 at 16:09, Hyman Rosen <hyman...@gmail.com> wrote:
>> > Given my endless arguing in the order-of-evaluation threads, I have
>> > really
>> > come to hate the "promotes bad code" arguments.  The proof that break
>> > Label;
>> > is good is that Ada has it.  And by the way, have none of the "bad code"
>> > arguers ever had to exit a for loop from inside a switch statement?
>>
>> Not after writing the code to be less bad, i.e. not to contain a for
>> loop inside a switch statement.
>> I tend not to nest loops, and especially not to nest loops under
>> selection statements.
>
>
> I believe you read that backwards.  The switch is inside the for.


Good catch. I don't recall doing that all that often either, except
when the return mechanism
used is a) a return b) an exception.

--
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/CAFk2RUbWc2O3f95cbuQq%3D-k%2BkiT4FqrvWhvpzcH9nTu0yU8fSQ%40mail.gmail.com.

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Fri, 9 Sep 2016 10:30:05 -0400
Raw View
--94eb2c192e7494dfdc053c13fbe0
Content-Type: text/plain; charset=UTF-8

On Fri, Sep 9, 2016 at 9:55 AM, Ville Voutilainen <
ville.voutilainen@gmail.com> wrote:

> On 9 September 2016 at 16:09, Hyman Rosen <hyman.rosen@gmail.com> wrote:
> > Given my endless arguing in the order-of-evaluation threads, I have
> really
> > come to hate the "promotes bad code" arguments.  The proof that break
> Label;
> > is good is that Ada has it.  And by the way, have none of the "bad code"
> > arguers ever had to exit a for loop from inside a switch statement?
>
>
> Not after writing the code to be less bad, i.e. not to contain a for
> loop inside a switch statement.
> I tend not to nest loops, and especially not to nest loops under
> selection statements.
>

I think it is the opposite - the switch is inside the for-loop.  Thus you
can't use 'break' to break from the for-loop.

FWIW.


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



--
Be seeing you,
Tony

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

--94eb2c192e7494dfdc053c13fbe0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Fri, Sep 9, 2016 at 9:55 AM, Ville Voutilainen <span dir=3D"ltr">&lt=
;<a href=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.vou=
tilainen@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quot=
e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">=
<span class=3D"">On 9 September 2016 at 16:09, Hyman Rosen &lt;<a href=3D"m=
ailto:hyman.rosen@gmail.com">hyman.rosen@gmail.com</a>&gt; wrote:<br>
&gt; Given my endless arguing in the order-of-evaluation threads, I have re=
ally<br>
&gt; come to hate the &quot;promotes bad code&quot; arguments.=C2=A0 The pr=
oof that break Label;<br>
&gt; is good is that Ada has it.=C2=A0 And by the way, have none of the &qu=
ot;bad code&quot;<br>
&gt; arguers ever had to exit a for loop from inside a switch statement?<br=
>
<br>
<br>
</span>Not after writing the code to be less bad, i.e. not to contain a for=
<br>
loop inside a switch statement.<br>
I tend not to nest loops, and especially not to nest loops under<br>
selection statements.<br></blockquote><div><br></div><div>I think it is the=
 opposite - the switch is inside the for-loop.=C2=A0 Thus you can&#39;t use=
 &#39;break&#39; to break from the for-loop.<br><br></div><div>FWIW.<br>=C2=
=A0<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex">
<span class=3D""><br>
--<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%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@<wbr>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>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUbXO4nirwFzSwsMHeLk6w4KO=
k36Qo1VO6hYDfLGnuMJeQ%40mail.gmail.com" rel=3D"noreferrer" target=3D"_blank=
">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/<w=
br>CAFk2RUbXO4nirwFzSwsMHeLk6w4KO<wbr>k36Qo1VO6hYDfLGnuMJeQ%40mail.<wbr>gma=
il.com</a>.<br>
</blockquote></div><br><br clear=3D"all"><br>-- <br><div class=3D"gmail_sig=
nature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div>Be seeing =
you,<br></div>Tony<br></div></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/CAOHCbiviq_DtOYKXWxdkQfpFyTe7MoT2Mmpo=
7NuwAx1iYBdU6w%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbiviq_DtOYKX=
WxdkQfpFyTe7MoT2Mmpo7NuwAx1iYBdU6w%40mail.gmail.com</a>.<br />

--94eb2c192e7494dfdc053c13fbe0--

.


Author: Peter Koch Larsen <peter.koch.larsen@gmail.com>
Date: Fri, 9 Sep 2016 13:45:54 -0700 (PDT)
Raw View
------=_Part_6006_1892411596.1473453954648
Content-Type: multipart/alternative;
 boundary="----=_Part_6007_56974220.1473453954649"

------=_Part_6007_56974220.1473453954649
Content-Type: text/plain; charset=UTF-8



Den fredag den 9. september 2016 kl. 15.09.53 UTC+2 skrev Hyman Rosen:
>
> Given my endless arguing in the order-of-evaluation threads, I have really
> come to hate the "promotes bad code" arguments.  The proof that *break
> Label;* is good is that Ada has it.  And by the way, have none of the
> "bad code" arguers ever had to exit a *for* loop from inside a *switch*
> statement?
>
> No, I have never had to do that. It would be nice to see actual code
written in modern C++ demonstrating the problem. Perhaps good examples can
be found on Github?
By the way, I do not buy the argument that everything in the Ada standard
is good.

/Peter

--
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/c85174bf-4ac3-4ad4-ad4d-c57aefe3d6b6%40isocpp.org.

------=_Part_6007_56974220.1473453954649
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>Den fredag den 9. september 2016 kl. 15.09.53 UTC+=
2 skrev Hyman Rosen:<blockquote class=3D"gmail_quote" style=3D"margin: 0px =
0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); bo=
rder-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr">Given my =
endless arguing in the order-of-evaluation threads, I have really come to h=
ate the &quot;promotes bad code&quot; arguments.=C2=A0 The proof that <font=
 face=3D"monospace, monospace"><b>break <i>Label</i>;</b></font> is good is=
 that Ada has it.=C2=A0 And by the way, have none of the &quot;bad code&quo=
t; arguers ever had to exit a <font face=3D"comic sans ms, sans-serif"><b>f=
or</b></font> loop from inside a <font face=3D"monospace, monospace"><b>swi=
tch</b></font> statement?</div><div><br></div></blockquote><div>No, I have =
never=C2=A0had to do that. It would be nice to see actual code written in m=
odern C++ demonstrating the problem. Perhaps good examples can be found on =
Github?</div><div>By the way, I do not buy the argument that everything in =
the Ada standard is good.</div><div><br></div><div>/Peter</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/c85174bf-4ac3-4ad4-ad4d-c57aefe3d6b6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c85174bf-4ac3-4ad4-ad4d-c57aefe3d6b6=
%40isocpp.org</a>.<br />

------=_Part_6007_56974220.1473453954649--

------=_Part_6006_1892411596.1473453954648--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 11 Sep 2016 09:56:40 -0700 (PDT)
Raw View
------=_Part_151_693448973.1473613000966
Content-Type: multipart/alternative;
 boundary="----=_Part_152_1719414985.1473613000966"

------=_Part_152_1719414985.1473613000966
Content-Type: text/plain; charset=UTF-8

On Thursday, September 8, 2016 at 2:26:19 PM UTC-4, szollos...@gmail.com
wrote:
>
> Hi,
>
> Note that this is essentially solved by the idea of 'capturing monads in
> lambdas'.
>

Now that I have a better grasp of that idea, I fail to see how your version
constitutes a superior version of the feature, relative to a `goto`.
Consider the example you posted there:

for (auto&& person : people)
{
    auto break_twice = [&break]{ break; }
    for (auto&& phone : person.phones)
    {
        if (isLandline(phone))
        {
            std::cout << person.name << " " << phone
                      << " still uses landline, do not switch it off!"
                      << std::endl;
            break_twice();
        }
    }
}

As I understand your feature, that is not a "break twice". The `break` will
happen relative to the level where the lambda was *defined*. That is, it
will break from out of the first loop. It doesn't break twice from wherever
you happen to be *when you call it*. It breaks out of the loop in which the
lambda was defined.

That's very different from `break(2)`, which always goes back 2 levels.

If that weren't the case, if calling the function executed a `break` that
was relative to the call site... then it would be no different than just
typing `break`, right? So it has to work relative to where it is defined.

The labeled `goto` case works essentially the same way:

for (auto&& person : people)
{
    for (auto&& phone : person.phones)
    {
        if (isLandline(phone))
        {
            std::cout << person.name << " " << phone
                      << " still uses landline, do not switch it off!"
                      << std::endl;
            goto break_twice;
        }
    }
} break_twice:

In both cases, you are always breaking out of the outer loop, no matter how
many loops are in the way. Both cases require explicitly marking, not the
number of loops to exit, but the location you're exiting to.

So what's the difference?

--
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/d30b26c7-3dd0-4c96-ac7e-275561ee7033%40isocpp.org.

------=_Part_152_1719414985.1473613000966
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, September 8, 2016 at 2:26:19 PM UTC-4, szollo=
s...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">Hi,<br><br>Note that this is essentially solved by the idea of &#3=
9;capturing monads in lambdas&#39;.<br></div></blockquote><div><br>Now that=
 I have a better grasp of that idea, I fail to see how your version constit=
utes a superior version of the feature, relative to a `goto`. Consider the =
example you posted there:<br><br><div class=3D"prettyprint" style=3D"backgr=
ound-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-st=
yle: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prett=
yprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D=
"styled-by-prettify">for</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> person </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> people</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> break_twice </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">[&amp;</span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">break</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">]{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">break</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">for</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">auto</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> phone </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> p=
erson</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">phones</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><s=
pan style=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 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">if</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">isLandline</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">phone</span><span style=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 =C2=A0 </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">cout </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> person</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">name </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080=
;" class=3D"styled-by-prettify">&quot; &quot;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> phone<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">&quot; still uses landline, do not switch it off!&quot;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">endl</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bre=
ak_twice</span><span style=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 =C2=A0 </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}=
</span></div></code></div><br>As I understand your feature, that is not a &=
quot;break twice&quot;. The `break` will happen relative to the level where=
 the lambda was <i>defined</i>. That is, it will break from out of the firs=
t loop. It doesn&#39;t break twice from wherever you happen to be <i>when y=
ou call it</i>. It breaks out of the loop in which the lambda was defined.<=
br><br>That&#39;s very different from `break(2)`, which always goes back 2 =
levels.<br><br>If that weren&#39;t the case, if calling the function execut=
ed a `break` that was relative to the call site... then it would be no diff=
erent than just typing `break`, right? So it has to work relative to where =
it is defined.<br><br>The labeled `goto` case works essentially the same wa=
y:<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 25=
0, 250); border-color: rgb(187, 187, 187); border-style: solid; border-widt=
h: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"s=
ubprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">fo=
r</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> person </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> people</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">for</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> phone </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> person</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">phones</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">if</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">isLandline</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">phone</span><span style=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 =C2=A0 </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">cout </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> person</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">name </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pretti=
fy">&quot; &quot;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> pho=
ne<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot; still =
uses landline, do not switch it off!&quot;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">endl</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">goto</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> break_twice</span><span style=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 =C2=A0 </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> break_twice</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">:</span></div></code></div><br>In both cases, you are a=
lways breaking out of the outer loop, no matter how many loops are in the w=
ay. Both cases require explicitly marking, not the number of loops to exit,=
 but the location you&#39;re exiting to.<br><br>So what&#39;s the differenc=
e?</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/d30b26c7-3dd0-4c96-ac7e-275561ee7033%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d30b26c7-3dd0-4c96-ac7e-275561ee7033=
%40isocpp.org</a>.<br />

------=_Part_152_1719414985.1473613000966--

------=_Part_151_693448973.1473613000966--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Mon, 12 Sep 2016 18:59:41 -0400
Raw View
--001a114a7bfabe9104053c57744f
Content-Type: text/plain; charset=UTF-8

And the labeled break is superior to both:

outer: for (auto&& person : people) {
    inner: for (auto&& phone : person.phones) {
        if (isLandline(phone)) {
            std::cout << person.name << " " << phone
                      << " still uses landline, do not switch it off!"
                      << std::endl;
            break outer;
        }
    }
}

The label is seen before the statement that uses it, and break and continue
statements are already "grokked" by programmers of C-derived languages.
That means readers of the code don't have to worry about where a goto is
going.  That's why they invented structured programming, after all.

--
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/CAHSYqdaq0HRhpn9%3DXyY0W9wf0X32Li1rEvJWvp-7CbtavAE4gw%40mail.gmail.com.

--001a114a7bfabe9104053c57744f
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">And the labeled break is superior to both:<br><br><font fa=
ce=3D"monospace, monospace"><span style=3D"font-size:10.4px;color:rgb(0,0,1=
36);background-color:rgb(250,250,250)">outer: for</span><span style=3D"font=
-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0</sp=
an><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rg=
b(250,250,250)">(</span><span style=3D"font-size:10.4px;color:rgb(0,0,136);=
background-color:rgb(250,250,250)">auto</span><span style=3D"font-size:10.4=
px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&amp;&amp;</span=
><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,=
250,250)">=C2=A0person=C2=A0</span><span style=3D"font-size:10.4px;color:rg=
b(102,102,0);background-color:rgb(250,250,250)">:</span><span style=3D"font=
-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0peop=
le</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-co=
lor:rgb(250,250,250)">)=C2=A0</span><span style=3D"font-size:10.4px;color:r=
gb(102,102,0);background-color:rgb(250,250,250)">{</span><span style=3D"fon=
t-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=
=A0 =C2=A0 inner:=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(0,0=
,136);background-color:rgb(250,250,250)">for</span><span style=3D"font-size=
:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0</span><s=
pan style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250=
,250,250)">(</span><span style=3D"font-size:10.4px;color:rgb(0,0,136);backg=
round-color:rgb(250,250,250)">auto</span><span style=3D"font-size:10.4px;co=
lor:rgb(102,102,0);background-color:rgb(250,250,250)">&amp;&amp;</span><spa=
n style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,2=
50)">=C2=A0phone=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,=
102,0);background-color:rgb(250,250,250)">:</span><span style=3D"font-size:=
10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0person</sp=
an><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rg=
b(250,250,250)">.</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);ba=
ckground-color:rgb(250,250,250)">phones</span><span style=3D"font-size:10.4=
px;color:rgb(102,102,0);background-color:rgb(250,250,250)">)=C2=A0</span><s=
pan style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250=
,250,250)">{</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);backgro=
und-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><sp=
an style=3D"font-size:10.4px;color:rgb(0,0,136);background-color:rgb(250,25=
0,250)">if</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);backgroun=
d-color:rgb(250,250,250)">=C2=A0</span><span style=3D"font-size:10.4px;colo=
r:rgb(102,102,0);background-color:rgb(250,250,250)">(</span><span style=3D"=
font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">isLand=
line</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-=
color:rgb(250,250,250)">(</span><span style=3D"font-size:10.4px;color:rgb(0=
,0,0);background-color:rgb(250,250,250)">phone</span><span style=3D"font-si=
ze:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">))</span>=
<span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,2=
50,250)">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);=
background-color:rgb(250,250,250)">{</span><span style=3D"font-size:10.4px;=
color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"font-size:10.4px;color:rg=
b(102,102,0);background-color:rgb(250,250,250)">::</span><span style=3D"fon=
t-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">cout=C2=
=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-c=
olor:rgb(250,250,250)">&lt;&lt;</span><span style=3D"font-size:10.4px;color=
:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0person</span><span sty=
le=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,25=
0)">.</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-col=
or:rgb(250,250,250)">name=C2=A0</span><span style=3D"font-size:10.4px;color=
:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;&lt;</span><span sty=
le=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=
=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(0,136,0);background-=
color:rgb(250,250,250)">&quot; &quot;</span><span style=3D"font-size:10.4px=
;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0</span><span sty=
le=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,25=
0)">&lt;&lt;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);backgro=
und-color:rgb(250,250,250)">=C2=A0phone<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"fo=
nt-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;=
&lt;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-colo=
r:rgb(250,250,250)">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(=
0,136,0);background-color:rgb(250,250,250)">&quot; still uses landline, do =
not switch it off!&quot;</span><span style=3D"font-size:10.4px;color:rgb(0,=
0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"fo=
nt-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;=
&lt;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-colo=
r:rgb(250,250,250)">=C2=A0std</span><span style=3D"font-size:10.4px;color:r=
gb(102,102,0);background-color:rgb(250,250,250)">::</span><span style=3D"fo=
nt-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">endl</sp=
an><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rg=
b(250,250,250)">;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);ba=
ckground-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background=
-color:rgb(250,250,250)">break outer</span><span style=3D"font-size:10.4px;=
color:rgb(102,102,0);background-color:rgb(250,250,250)">;</span><span style=
=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10.4px;c=
olor:rgb(102,102,0);background-color:rgb(250,250,250)">}</span><span style=
=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><b=
r>=C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,1=
02,0);background-color:rgb(250,250,250)">}</span><span style=3D"font-size:1=
0.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br></span><span =
style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250=
,250)">}</span></font><div><font face=3D"monospace, monospace"><span style=
=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)=
"><br></span></font></div><div><span style=3D"font-size:12.8px">The label i=
s seen before the statement that uses it, and break and continue statements=
 are already &quot;grokked&quot; by programmers of C-derived languages.=C2=
=A0 That means readers of the code don&#39;t have to worry about where a go=
to is going.=C2=A0 That&#39;s why they invented structured programming, aft=
er all.</span><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/CAHSYqdaq0HRhpn9%3DXyY0W9wf0X32Li1rEv=
JWvp-7CbtavAE4gw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdaq0HRhpn=
9%3DXyY0W9wf0X32Li1rEvJWvp-7CbtavAE4gw%40mail.gmail.com</a>.<br />

--001a114a7bfabe9104053c57744f--

.


Author: amgstc@gmail.com
Date: Wed, 14 Sep 2016 08:37:12 -0700 (PDT)
Raw View
------=_Part_724_687305035.1473867432330
Content-Type: multipart/alternative;
 boundary="----=_Part_725_2096382346.1473867432330"

------=_Part_725_2096382346.1473867432330
Content-Type: text/plain; charset=UTF-8

while ( there are ppl wants to complicate things )
{
     while( they want to define labels and write more than necessary )
     {
 break2; // make your life simpler
     }
}




On Tuesday, September 13, 2016 at 1:00:03 AM UTC+2, Hyman Rosen wrote:
>
> And the labeled break is superior to both:
>
> outer: for (auto&& person : people) {
>     inner: for (auto&& phone : person.phones) {
>         if (isLandline(phone)) {
>             std::cout << person.name << " " << phone
>                       << " still uses landline, do not switch it off!"
>                       << std::endl;
>             break outer;
>         }
>     }
> }
>
> The label is seen before the statement that uses it, and break and
> continue statements are already "grokked" by programmers of C-derived
> languages.  That means readers of the code don't have to worry about where
> a goto is going.  That's why they invented structured programming, after
> all.
>

--
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/765ea407-3ab0-4cc9-8bf2-e59c168a7bd0%40isocpp.org.

------=_Part_725_2096382346.1473867432330
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>while ( there are ppl wants to complicate things )<br=
></div><div>{</div><div>=C2=A0 =C2=A0 =C2=A0while( they want to define labe=
ls and write more than necessary )</div><div>=C2=A0 =C2=A0 =C2=A0{</div><di=
v><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span> =C2=A0b=
reak2; // make your life simpler</div><div>=C2=A0 =C2=A0 =C2=A0}</div><div>=
}</div><div><br></div><div><br></div><div><br></div><br>On Tuesday, Septemb=
er 13, 2016 at 1:00:03 AM UTC+2, Hyman Rosen wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid=
;padding-left: 1ex;"><div dir=3D"ltr">And the labeled break is superior to =
both:<br><br><font face=3D"monospace, monospace"><span style=3D"font-size:1=
0.4px;color:rgb(0,0,136);background-color:rgb(250,250,250)">outer: for</spa=
n><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250=
,250,250)">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0=
);background-color:rgb(250,250,250)">(</span><span style=3D"font-size:10.4p=
x;color:rgb(0,0,136);background-color:rgb(250,250,250)">auto</span><span st=
yle=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,2=
50)">&amp;&amp;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);back=
ground-color:rgb(250,250,250)">=C2=A0person=C2=A0</span><span style=3D"font=
-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">:</spa=
n><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250=
,250,250)">=C2=A0people</span><span style=3D"font-size:10.4px;color:rgb(102=
,102,0);background-color:rgb(250,250,250)">)=C2=A0</span><span style=3D"fon=
t-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">{</sp=
an><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(25=
0,250,250)"><br>=C2=A0 =C2=A0 inner:=C2=A0</span><span style=3D"font-size:1=
0.4px;color:rgb(0,0,136);background-color:rgb(250,250,250)">for</span><span=
 style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,25=
0)">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backg=
round-color:rgb(250,250,250)">(</span><span style=3D"font-size:10.4px;color=
:rgb(0,0,136);background-color:rgb(250,250,250)">auto</span><span style=3D"=
font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&a=
mp;&amp;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-=
color:rgb(250,250,250)">=C2=A0phone=C2=A0</span><span style=3D"font-size:10=
..4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">:</span><span =
style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250=
)">=C2=A0<wbr>person</span><span style=3D"font-size:10.4px;color:rgb(102,10=
2,0);background-color:rgb(250,250,250)">.</span><span style=3D"font-size:10=
..4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">phones</span><span=
 style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,25=
0,250)">)=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);=
background-color:rgb(250,250,250)">{</span><span style=3D"font-size:10.4px;=
color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(0,0,136);b=
ackground-color:rgb(250,250,250)">if</span><span style=3D"font-size:10.4px;=
color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0</span><span styl=
e=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250=
)">(</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-colo=
r:rgb(250,250,250)">isLandline</span><span style=3D"font-size:10.4px;color:=
rgb(102,102,0);background-color:rgb(250,250,250)">(</span><span style=3D"fo=
nt-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">phone</s=
pan><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:r=
gb(250,250,250)">))</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);=
background-color:rgb(250,250,250)">=C2=A0</span><span style=3D"font-size:10=
..4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">{</span><span =
style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250=
)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"f=
ont-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">::<=
/span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb=
(250,250,250)">cout=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(1=
02,102,0);background-color:rgb(250,250,250)">&lt;&lt;</span><span style=3D"=
font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0=
person</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backgroun=
d-color:rgb(250,250,250)">.</span><span style=3D"font-size:10.4px;color:rgb=
(0,0,0);background-color:rgb(250,250,250)">name=C2=A0</span><span style=3D"=
font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&l=
t;&lt;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-co=
lor:rgb(250,250,250)">=C2=A0</span><span style=3D"font-size:10.4px;color:rg=
b(0,136,0);background-color:rgb(250,250,250)">&quot; &quot;</span><span sty=
le=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=
=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backgroun=
d-color:rgb(250,250,250)">&lt;&lt;</span><span style=3D"font-size:10.4px;co=
lor:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0phone<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</s=
pan><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:r=
gb(250,250,250)">&lt;&lt;</span><span style=3D"font-size:10.4px;color:rgb(0=
,0,0);background-color:rgb(250,250,250)">=C2=A0</span><span style=3D"font-s=
ize:10.4px;color:rgb(0,136,0);background-color:rgb(250,250,250)">&quot; sti=
ll uses landline, do not switch it off!&quot;</span><span style=3D"font-siz=
e:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</s=
pan><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:r=
gb(250,250,250)">&lt;&lt;</span><span style=3D"font-size:10.4px;color:rgb(0=
,0,0);background-color:rgb(250,250,250)">=C2=A0std</span><span style=3D"fon=
t-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">::</s=
pan><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(2=
50,250,250)">endl</span><span style=3D"font-size:10.4px;color:rgb(102,102,0=
);background-color:rgb(250,250,250)">;</span><span style=3D"font-size:10.4p=
x;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10.4px;color:=
rgb(0,0,0);background-color:rgb(250,250,250)">break outer</span><span style=
=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)=
">;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color=
:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=
=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)=
">}</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color=
:rgb(250,250,250)"><br>=C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:1=
0.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">}</span><span=
 style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,25=
0)"><br></span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backgro=
und-color:rgb(250,250,250)">}</span></font><div><font face=3D"monospace, mo=
nospace"><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-co=
lor:rgb(250,250,250)"><br></span></font></div><div><span style=3D"font-size=
:12.8px">The label is seen before the statement that uses it, and break and=
 continue statements are already &quot;grokked&quot; by programmers of C-de=
rived languages.=C2=A0 That means readers of the code don&#39;t have to wor=
ry about where a goto is going.=C2=A0 That&#39;s why they invented structur=
ed programming, after all.</span><br></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/765ea407-3ab0-4cc9-8bf2-e59c168a7bd0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/765ea407-3ab0-4cc9-8bf2-e59c168a7bd0=
%40isocpp.org</a>.<br />

------=_Part_725_2096382346.1473867432330--

------=_Part_724_687305035.1473867432330--

.


Author: Ren Industries <renindustries@gmail.com>
Date: Wed, 14 Sep 2016 12:14:21 -0400
Raw View
--001a1148ebceb1f1ef053c7a05c2
Content-Type: text/plain; charset=UTF-8

break2 does not make anyones life easier except in very trivial cases. In
larger cases, it causes much more "spooky action at a distance" than
labels, which are much neater, cleaner, and more explicit.


On Wed, Sep 14, 2016 at 11:37 AM, <amgstc@gmail.com> wrote:

> while ( there are ppl wants to complicate things )
> {
>      while( they want to define labels and write more than necessary )
>      {
>  break2; // make your life simpler
>      }
> }
>
>
>
>
> On Tuesday, September 13, 2016 at 1:00:03 AM UTC+2, Hyman Rosen wrote:
>>
>> And the labeled break is superior to both:
>>
>> outer: for (auto&& person : people) {
>>     inner: for (auto&& phone : person.phones) {
>>         if (isLandline(phone)) {
>>             std::cout << person.name << " " << phone
>>                       << " still uses landline, do not switch it off!"
>>                       << std::endl;
>>             break outer;
>>         }
>>     }
>> }
>>
>> The label is seen before the statement that uses it, and break and
>> continue statements are already "grokked" by programmers of C-derived
>> languages.  That means readers of the code don't have to worry about where
>> a goto is going.  That's why they invented structured programming, after
>> all.
>>
> --
> 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/765ea407-3ab0-4cc9-
> 8bf2-e59c168a7bd0%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/765ea407-3ab0-4cc9-8bf2-e59c168a7bd0%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/CAMD6iD8USApU8i6rdkedyD-Xdffx-mNiXeCXWnY8VGMDj3X%2BQQ%40mail.gmail.com.

--001a1148ebceb1f1ef053c7a05c2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">break2 does not make anyones life easier except in very tr=
ivial cases. In larger cases, it causes much more &quot;spooky action at a =
distance&quot; than labels, which are much neater, cleaner, and more explic=
it.<div><br></div></div><div class=3D"gmail_extra"><br><div class=3D"gmail_=
quote">On Wed, Sep 14, 2016 at 11:37 AM,  <span dir=3D"ltr">&lt;<a href=3D"=
mailto:amgstc@gmail.com" target=3D"_blank">amgstc@gmail.com</a>&gt;</span> =
wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>while ( ther=
e are ppl wants to complicate things )<br></div><div>{</div><div>=C2=A0 =C2=
=A0 =C2=A0while( they want to define labels and write more than necessary )=
</div><div>=C2=A0 =C2=A0 =C2=A0{</div><div><span style=3D"white-space:pre-w=
rap"> </span> =C2=A0break2; // make your life simpler</div><span class=3D""=
><div>=C2=A0 =C2=A0 =C2=A0}</div><div>}</div><div><br></div><div><br></div>=
<div><br></div><br>On Tuesday, September 13, 2016 at 1:00:03 AM UTC+2, Hyma=
n Rosen wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-le=
ft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">And =
the labeled break is superior to both:<br><br><font face=3D"monospace, mono=
space"><span style=3D"font-size:10.4px;color:rgb(0,0,136);background-color:=
rgb(250,250,250)">outer: for</span><span style=3D"font-size:10.4px;color:rg=
b(0,0,0);background-color:rgb(250,250,250)">=C2=A0</span><span style=3D"fon=
t-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">(</sp=
an><span style=3D"font-size:10.4px;color:rgb(0,0,136);background-color:rgb(=
250,250,250)">auto</span><span style=3D"font-size:10.4px;color:rgb(102,102,=
0);background-color:rgb(250,250,250)">&amp;&amp;</span><span style=3D"font-=
size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0perso=
n=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backgrou=
nd-color:rgb(250,250,250)">:</span><span style=3D"font-size:10.4px;color:rg=
b(0,0,0);background-color:rgb(250,250,250)">=C2=A0people</span><span style=
=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)=
">)=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backgr=
ound-color:rgb(250,250,250)">{</span><span style=3D"font-size:10.4px;color:=
rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 inner:=C2=
=A0</span><span style=3D"font-size:10.4px;color:rgb(0,0,136);background-col=
or:rgb(250,250,250)">for</span><span style=3D"font-size:10.4px;color:rgb(0,=
0,0);background-color:rgb(250,250,250)">=C2=A0</span><span style=3D"font-si=
ze:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">(</span><=
span style=3D"font-size:10.4px;color:rgb(0,0,136);background-color:rgb(250,=
250,250)">auto</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);b=
ackground-color:rgb(250,250,250)">&amp;&amp;</span><span style=3D"font-size=
:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0phone=C2=
=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-c=
olor:rgb(250,250,250)">:</span><span style=3D"font-size:10.4px;color:rgb(0,=
0,0);background-color:rgb(250,250,250)">=C2=A0per<wbr>son</span><span style=
=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)=
">.</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color=
:rgb(250,250,250)">phones</span><span style=3D"font-size:10.4px;color:rgb(1=
02,102,0);background-color:rgb(250,250,250)">)=C2=A0</span><span style=3D"f=
ont-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">{</=
span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(=
250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"fo=
nt-size:10.4px;color:rgb(0,0,136);background-color:rgb(250,250,250)">if</sp=
an><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(25=
0,250,250)">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,=
0);background-color:rgb(250,250,250)">(</span><span style=3D"font-size:10.4=
px;color:rgb(0,0,0);background-color:rgb(250,250,250)">isLandline</span><sp=
an style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,=
250,250)">(</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);backgrou=
nd-color:rgb(250,250,250)">phone</span><span style=3D"font-size:10.4px;colo=
r:rgb(102,102,0);background-color:rgb(250,250,250)">))</span><span style=3D=
"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=
=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-c=
olor:rgb(250,250,250)">{</span><span style=3D"font-size:10.4px;color:rgb(0,=
0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 std</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);b=
ackground-color:rgb(250,250,250)">::</span><span style=3D"font-size:10.4px;=
color:rgb(0,0,0);background-color:rgb(250,250,250)">cout=C2=A0</span><span =
style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250=
,250)">&lt;&lt;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);back=
ground-color:rgb(250,250,250)">=C2=A0person</span><span style=3D"font-size:=
10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">.</span><spa=
n style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,2=
50)">name=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);=
background-color:rgb(250,250,250)">&lt;&lt;</span><span style=3D"font-size:=
10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0</span><sp=
an style=3D"font-size:10.4px;color:rgb(0,136,0);background-color:rgb(250,25=
0,250)">&quot; &quot;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0=
);background-color:rgb(250,250,250)">=C2=A0</span><span style=3D"font-size:=
10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;&lt;</sp=
an><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(25=
0,250,250)">=C2=A0phone<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10.4px;co=
lor:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;&lt;</span><span =
style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250=
)">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(0,136,0);backgrou=
nd-color:rgb(250,250,250)">&quot; still uses landline, do not switch it off=
!&quot;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-c=
olor:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10.4px;co=
lor:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;&lt;</span><span =
style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250=
)">=C2=A0std</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);bac=
kground-color:rgb(250,250,250)">::</span><span style=3D"font-size:10.4px;co=
lor:rgb(0,0,0);background-color:rgb(250,250,250)">endl</span><span style=3D=
"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">;=
</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rg=
b(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><=
span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,25=
0,250)">break outer</span><span style=3D"font-size:10.4px;color:rgb(102,102=
,0);background-color:rgb(250,250,250)">;</span><span style=3D"font-size:10.=
4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102=
,0);background-color:rgb(250,250,250)">}</span><span style=3D"font-size:10.=
4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0=
=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backgroun=
d-color:rgb(250,250,250)">}</span><span style=3D"font-size:10.4px;color:rgb=
(0,0,0);background-color:rgb(250,250,250)"><br></span><span style=3D"font-s=
ize:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">}</span>=
</font><div><font face=3D"monospace, monospace"><span style=3D"font-size:10=
..4px;color:rgb(102,102,0);background-color:rgb(250,250,250)"><br></span></f=
ont></div><div><span style=3D"font-size:12.8px">The label is seen before th=
e statement that uses it, and break and continue statements are already &qu=
ot;grokked&quot; by programmers of C-derived languages.=C2=A0 That means re=
aders of the code don&#39;t have to worry about where a goto is going.=C2=
=A0 That&#39;s why they invented structured programming, after all.</span><=
br></div></div>
</blockquote></span></div><span class=3D"">

<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@<wbr>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></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/765ea407-3ab0-4cc9-8bf2-e59c168a7bd0%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/765e=
a407-3ab0-4cc9-<wbr>8bf2-e59c168a7bd0%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></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/CAMD6iD8USApU8i6rdkedyD-Xdffx-mNiXeCX=
WnY8VGMDj3X%2BQQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMD6iD8USApU8i=
6rdkedyD-Xdffx-mNiXeCXWnY8VGMDj3X%2BQQ%40mail.gmail.com</a>.<br />

--001a1148ebceb1f1ef053c7a05c2--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Thu, 15 Sep 2016 00:40:12 -0700 (PDT)
Raw View
------=_Part_82_1356444604.1473925212307
Content-Type: multipart/alternative;
 boundary="----=_Part_83_1039410904.1473925212307"

------=_Part_83_1039410904.1473925212307
Content-Type: text/plain; charset=UTF-8

Good idea. This makes break usable in code like this:

for(;;)
{
    switch(...)
    {
        case ...:
            break(2); // exit the for loop
    }
}



--
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/42f89799-ae67-4fd1-9940-0edfe7f3c02d%40isocpp.org.

------=_Part_83_1039410904.1473925212307
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Good idea. This makes <span style=3D"font-family: courier =
new,monospace;">break</span> usable in code like this:<br><br><div class=3D=
"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: =
rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: brea=
k-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span st=
yle=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:=
 #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>=C2=A0 =C2=A0 </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">switch</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(...)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">case</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">...:</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">break</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #066;" class=3D"styled-by-prettify">2</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: #800;" class=
=3D"styled-by-prettify">// exit the for loop</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br><br></span></div></code></div><br><br></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/42f89799-ae67-4fd1-9940-0edfe7f3c02d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/42f89799-ae67-4fd1-9940-0edfe7f3c02d=
%40isocpp.org</a>.<br />

------=_Part_83_1039410904.1473925212307--

------=_Part_82_1356444604.1473925212307--

.


Author: "D. B." <db0451@gmail.com>
Date: Thu, 15 Sep 2016 09:49:00 +0100
Raw View
--047d7b4508a8ce56bb053c87ea5d
Content-Type: text/plain; charset=UTF-8

On Thu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <
victor.dyachenko@gmail.com> wrote:

> Good idea. This makes break usable in code like this:
>
> for(;;)
> {
>     switch(...)
>     {
>         case ...:
>             break(2); // exit the for loop
>     }
> }
>
>
>
The point is that it makes it "usable" but unnecessarily arcane and not
conducive to deeper loops - where the latter are presumably why people
think they want this in the first place. Sure, they could have it, and then
they'd have to mentally track how many loops they were currently in. Is
that really a benefit?

My vote still goes to the much-maligned goto, which gets excessive flak
because the community thinks (probably mostly in their imagination) that
noobs are going to do horrible things with it, but it exists precisely for
the rest of us to do stuff like this:

for(;;)
{
    switch(...)
    {
        case ...:
            goto out_of_for; // exit the for loop
    }
}

out_of_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/CACGiwhG-4xhTy1MWDu7m8SjbPZrShKnfpnsjNW08YYFVTGsh5g%40mail.gmail.com.

--047d7b4508a8ce56bb053c87ea5d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
hu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <span dir=3D"ltr">&lt;<a targ=
et=3D"_blank" href=3D"mailto:victor.dyachenko@gmail.com">victor.dyachenko@g=
mail.com</a>&gt;</span> wrote:<br><blockquote style=3D"margin:0px 0px 0px 0=
..8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class=3D"gmai=
l_quote"><div dir=3D"ltr">Good idea. This makes <span style=3D"font-family:=
courier new,monospace">break</span> usable in code like this:<br><br><div s=
tyle=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bor=
der-style:solid;border-width:1px;word-wrap:break-word"><code><div><span sty=
le=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">(;=
;)</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:r=
gb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:rgb(0,0,136)">switch</span><span style=3D"color:=
rgb(102,102,0)">(...)</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"colo=
r:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:r=
gb(0,0,136)">case</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(102,102,0)">...:</span><span style=3D"color:rgb(0,0,0)"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(0=
,0,136)">break</span><span style=3D"color:rgb(102,102,0)">(</span><span sty=
le=3D"color:rgb(0,102,102)">2</span><span style=3D"color:rgb(102,102,0)">);=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(13=
6,0,0)">// exit the for loop</span><span style=3D"color:rgb(0,0,0)"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><span style=
=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">}</sp=
an><span style=3D"color:rgb(0,0,0)"><br><br></span></div></code></div><br><=
/div></blockquote></div><br></div><div class=3D"gmail_extra">The point is t=
hat it makes it &quot;usable&quot; but unnecessarily arcane and not conduci=
ve to deeper loops - where the latter are presumably why people think they =
want this in the first place. Sure, they could have it, and then they&#39;d=
 have to mentally track how many loops they were currently in. Is that real=
ly a benefit?<br><br></div><div class=3D"gmail_extra">My vote still goes to=
 the much-maligned goto, which gets excessive flak because the community th=
inks (probably mostly in their imagination) that noobs are going to do horr=
ible things with it, but it exists precisely for the rest of us to do stuff=
 like this:<br></div><div class=3D"gmail_extra"><span style=3D"font-family:=
monospace,monospace"><br><code><div><span style=3D"color:rgb(0,0,136)">for<=
/span><span style=3D"color:rgb(102,102,0)">(;;)</span><span style=3D"color:=
rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">{</span><span s=
tyle=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb=
(0,0,136)">switch</span><span style=3D"color:rgb(102,102,0)">(...)</span><s=
pan style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"colo=
r:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">case</span><spa=
n style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">.=
...:</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 goto out_of_for</span><span style=3D"color:rgb(102,102,0)">;<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136=
,0,0)">// exit the for loop</span><span style=3D"color:rgb(0,0,0)"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><span style=
=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">}</sp=
an><span style=3D"color:rgb(0,0,0)"><br></span></div></code></span><span st=
yle=3D"font-family:monospace,monospace"><br></span></div><div class=3D"gmai=
l_extra"><span style=3D"font-family:monospace,monospace">out_of_for:<br></s=
pan><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/CACGiwhG-4xhTy1MWDu7m8SjbPZrShKnfpnsj=
NW08YYFVTGsh5g%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhG-4xhTy1MW=
Du7m8SjbPZrShKnfpnsjNW08YYFVTGsh5g%40mail.gmail.com</a>.<br />

--047d7b4508a8ce56bb053c87ea5d--

.


Author: Carl Cook <carl.cook@gmail.com>
Date: Thu, 15 Sep 2016 04:37:51 -0700 (PDT)
Raw View
------=_Part_16_269501747.1473939471848
Content-Type: multipart/alternative;
 boundary="----=_Part_17_1400625844.1473939471848"

------=_Part_17_1400625844.1473939471848
Content-Type: text/plain; charset=UTF-8



As a side note, but what about a "block" statement? I'd find this useful.
It's basically a more concise mechanism than do {} while (false);


E.g.


block
{
  DoSomethingUseful();

  if (x == 0)
    break;

  DoSomethingElse();

  if (y == 0)
    break;


}


On Thursday, 15 September 2016 10:49:03 UTC+2, D. B. wrote:
>
> On Thu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <victor.d...@gmail.com
> <javascript:>> wrote:
>
>> Good idea. This makes break usable in code like this:
>>
>> for(;;)
>> {
>>     switch(...)
>>     {
>>         case ...:
>>             break(2); // exit the for loop
>>     }
>> }
>>
>>
>>
> The point is that it makes it "usable" but unnecessarily arcane and not
> conducive to deeper loops - where the latter are presumably why people
> think they want this in the first place. Sure, they could have it, and then
> they'd have to mentally track how many loops they were currently in. Is
> that really a benefit?
>
> My vote still goes to the much-maligned goto, which gets excessive flak
> because the community thinks (probably mostly in their imagination) that
> noobs are going to do horrible things with it, but it exists precisely for
> the rest of us to do stuff like this:
>
> for(;;)
> {
>     switch(...)
>     {
>         case ...:
>             goto out_of_for; // exit the for loop
>     }
> }
>
> out_of_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/87539657-8d3e-407d-bca7-686bd7f6709a%40isocpp.org.

------=_Part_17_1400625844.1473939471848
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><p dir=3D"ltr" style=3D"font-family: arial, sans-serif; fo=
nt-size: small;">As a side note, but what about a &quot;block&quot; stateme=
nt? I&#39;d find this useful. It&#39;s basically a more concise mechanism t=
han do {} while (false);</p><p style=3D"font-family: arial, sans-serif; fon=
t-size: small;"><br></p><p style=3D"font-family: arial, sans-serif; font-si=
ze: small;">E.g.</p><p dir=3D"ltr" style=3D"font-family: arial, sans-serif;=
 font-size: small;"><br></p><p dir=3D"ltr" style=3D"font-family: arial, san=
s-serif; font-size: small;"></p><div class=3D"prettyprint" style=3D"border:=
 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb=
(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"=
><span style=3D"color: #000;" class=3D"styled-by-prettify">block <br></span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">DoSomethingUseful</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 <br>=C2=A0 </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">if</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">x</span><font color=3D"#666600"><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">=3D=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;=
" class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span></font><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">break</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br><br>=C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">Do</span><font color=3D"#000000"><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">SomethingElse</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></font><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">if</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
y </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span 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">break</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">}</span></div></code></div><br><p></p><br>On Thurs=
day, 15 September 2016 10:49:03 UTC+2, D. B.  wrote:<blockquote class=3D"gm=
ail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc soli=
d;padding-left: 1ex;"><div dir=3D"ltr"><div><div class=3D"gmail_quote">On T=
hu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <span dir=3D"ltr">&lt;<a href=
=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"XpPYj7buFgAJ" r=
el=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return tru=
e;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">victor.d...@=
gmail.com</a>&gt;</span> wrote:<br><blockquote style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class=3D"gma=
il_quote"><div dir=3D"ltr">Good idea. This makes <span style=3D"font-family=
:courier new,monospace">break</span> usable in code like this:<br><br><div =
style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bo=
rder-style:solid;border-width:1px;word-wrap:break-word"><code><div><span st=
yle=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">(=
;;)</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:=
rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =
</span><span style=3D"color:rgb(0,0,136)">switch</span><span style=3D"color=
:rgb(102,102,0)">(...)</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"c=
olor:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"colo=
r:rgb(0,0,136)">case</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(102,102,0)">...:</span><span style=3D"color:rgb(0,0,0)"><=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rg=
b(0,0,136)">break</span><span style=3D"color:rgb(102,102,0)">(</span><span =
style=3D"color:rgb(0,102,102)">2</span><span style=3D"color:rgb(102,102,0)"=
>);</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb=
(136,0,0)">// exit the for loop</span><span style=3D"color:rgb(0,0,0)"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><span sty=
le=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">}</=
span><span style=3D"color:rgb(0,0,0)"><br><br></span></div></code></div><br=
></div></blockquote></div><br></div><div>The point is that it makes it &quo=
t;usable&quot; but unnecessarily arcane and not conducive to deeper loops -=
 where the latter are presumably why people think they want this in the fir=
st place. Sure, they could have it, and then they&#39;d have to mentally tr=
ack how many loops they were currently in. Is that really a benefit?<br><br=
></div><div>My vote still goes to the much-maligned goto, which gets excess=
ive flak because the community thinks (probably mostly in their imagination=
) that noobs are going to do horrible things with it, but it exists precise=
ly for the rest of us to do stuff like this:<br></div><div><span style=3D"f=
ont-family:monospace,monospace"><br><code><div><span style=3D"color:rgb(0,0=
,136)">for</span><span style=3D"color:rgb(102,102,0)">(;;)</span><span styl=
e=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">{</s=
pan><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:rgb(0,0,136)">switch</span><span style=3D"color:rgb(102,102,0)">(=
....)</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">case=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(10=
2,102,0)">...:</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 goto out_of_for</span><span style=3D"color:rgb(102=
,102,0)">;</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"co=
lor:rgb(136,0,0)">// exit the for loop</span><span style=3D"color:rgb(0,0,0=
)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><s=
pan style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,=
0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span></div></code></span=
><span style=3D"font-family:monospace,monospace"><br></span></div><div><spa=
n style=3D"font-family:monospace,monospace">out_of_for:<br></span><br></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/87539657-8d3e-407d-bca7-686bd7f6709a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/87539657-8d3e-407d-bca7-686bd7f6709a=
%40isocpp.org</a>.<br />

------=_Part_17_1400625844.1473939471848--

------=_Part_16_269501747.1473939471848--

.


Author: Carl Cook <carl.cook@gmail.com>
Date: Thu, 15 Sep 2016 04:40:26 -0700 (PDT)
Raw View
------=_Part_286_378350843.1473939626595
Content-Type: multipart/alternative;
 boundary="----=_Part_287_1993194375.1473939626595"

------=_Part_287_1993194375.1473939626595
Content-Type: text/plain; charset=UTF-8



As a side note, what about a "block" statement? I'd find this useful. It's
basically a more concise mechanism than do {} while (false);


E.g.


block
{
  DoSomethingUseful();
  if (x == 0)
    break;
  DoSomethingElse();
  if (y == 0)
    break;
  DoAnotherThing();
}

This way you don't end up with deeply nested if-then-else blocks. It's
fairly similar to a goto, but without actually being one ;)

Has this been proposed before?

Cheers,
Carl

On Thursday, 15 September 2016 10:49:03 UTC+2, D. B. wrote:
>
> On Thu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <victor.d...@gmail.com
> <javascript:>> wrote:
>
>> Good idea. This makes break usable in code like this:
>>
>> for(;;)
>> {
>>     switch(...)
>>     {
>>         case ...:
>>             break(2); // exit the for loop
>>     }
>> }
>>
>>
>>
> The point is that it makes it "usable" but unnecessarily arcane and not
> conducive to deeper loops - where the latter are presumably why people
> think they want this in the first place. Sure, they could have it, and then
> they'd have to mentally track how many loops they were currently in. Is
> that really a benefit?
>
> My vote still goes to the much-maligned goto, which gets excessive flak
> because the community thinks (probably mostly in their imagination) that
> noobs are going to do horrible things with it, but it exists precisely for
> the rest of us to do stuff like this:
>
> for(;;)
> {
>     switch(...)
>     {
>         case ...:
>             goto out_of_for; // exit the for loop
>     }
> }
>
> out_of_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/c7fc762d-b98a-4d05-9c21-b153b27d8a4b%40isocpp.org.

------=_Part_287_1993194375.1473939626595
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><p dir=3D"ltr" style=3D"font-size: small; font-family: ari=
al, sans-serif;">As a side note, what about a &quot;block&quot; statement? =
I&#39;d find this useful. It&#39;s basically a more concise mechanism than =
do {} while (false);</p><p style=3D"font-size: small; font-family: arial, s=
ans-serif;"><br></p><p style=3D"font-size: small; font-family: arial, sans-=
serif;">E.g.</p><p dir=3D"ltr" style=3D"font-size: small; font-family: aria=
l, sans-serif;"><br></p><p dir=3D"ltr" style=3D"font-size: small; font-fami=
ly: arial, sans-serif;"></p><div style=3D"border: 1px solid rgb(187, 187, 1=
87); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code><s=
pan style=3D"color: rgb(0, 0, 0);">block=C2=A0<br></span><span style=3D"col=
or: rgb(102, 102, 0);">{</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=
=A0=C2=A0</span><span style=3D"color: rgb(102, 0, 102);">DoSomethingUseful<=
/span><span style=3D"color: rgb(102, 102, 0);">();</span><span style=3D"col=
or: rgb(0, 0, 0);"><br>=C2=A0=C2=A0</span><span style=3D"color: rgb(0, 0, 1=
36);">if</span><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span styl=
e=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0);"=
>x</span><font color=3D"#666600"><span style=3D"color: rgb(0, 0, 0);">=C2=
=A0</span>=3D=3D<span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span sty=
le=3D"color: rgb(0, 102, 102);">0</span>)<span style=3D"color: rgb(0, 0, 0)=
;"><br></span></font><span style=3D"color: rgb(0, 0, 0);">=C2=A0 =C2=A0=C2=
=A0</span><span style=3D"color: rgb(0, 0, 136);">break</span><span style=3D=
"color: rgb(102, 102, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"><br=
>=C2=A0=C2=A0</span><span style=3D"color: rgb(102, 0, 102);">Do</span><font=
 color=3D"#000000"><span style=3D"color: rgb(102, 0, 102);">SomethingElse</=
span><span style=3D"color: rgb(102, 102, 0);">();</span></font><span style=
=3D"color: rgb(0, 0, 0);"><br>=C2=A0=C2=A0</span><span style=3D"color: rgb(=
0, 0, 136);">if</span><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><sp=
an style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, =
0, 0);">y=C2=A0</span><span style=3D"color: rgb(102, 102, 0);">=3D=3D</span=
><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"color: rg=
b(0, 102, 102);">0</span><span style=3D"color: rgb(102, 102, 0);">)</span><=
span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0=C2=A0</span><span sty=
le=3D"color: rgb(0, 0, 136);">break</span><span style=3D"color: rgb(102, 10=
2, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 DoAnotherTh=
ing();</span><span style=3D"color: rgb(0, 0, 0);"><br></span><span style=3D=
"color: rgb(102, 102, 0);">}</span></code></div><div><br></div><div>This wa=
y you don&#39;t end up with deeply nested if-then-else blocks. It&#39;s fai=
rly similar to a goto, but without actually being one ;)</div><div><br></di=
v><div>Has this been proposed before?</div><div><br></div><div>Cheers,</div=
><div>Carl</div><br>On Thursday, 15 September 2016 10:49:03 UTC+2, D. B.  w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><di=
v class=3D"gmail_quote">On Thu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <=
span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscat=
ed-mailto=3D"XpPYj7buFgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39=
;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39=
;;return true;">victor.d...@gmail.com</a>&gt;</span> wrote:<br><blockquote =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa=
dding-left:1ex" class=3D"gmail_quote"><div dir=3D"ltr">Good idea. This make=
s <span style=3D"font-family:courier new,monospace">break</span> usable in =
code like this:<br><br><div style=3D"background-color:rgb(250,250,250);bord=
er-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:bre=
ak-word"><code><div><span style=3D"color:rgb(0,0,136)">for</span><span styl=
e=3D"color:rgb(102,102,0)">(;;)</span><span style=3D"color:rgb(0,0,0)"><br>=
</span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rg=
b(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">switc=
h</span><span style=3D"color:rgb(102,102,0)">(...)</span><span style=3D"col=
or:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)=
">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
</span><span style=3D"color:rgb(0,0,136)">case</span><span style=3D"color:r=
gb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">...:</span><span st=
yle=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </sp=
an><span style=3D"color:rgb(0,0,136)">break</span><span style=3D"color:rgb(=
102,102,0)">(</span><span style=3D"color:rgb(0,102,102)">2</span><span styl=
e=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"> </spa=
n><span style=3D"color:rgb(136,0,0)">// exit the for loop</span><span style=
=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102=
,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D=
"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br><br></s=
pan></div></code></div><br></div></blockquote></div><br></div><div>The poin=
t is that it makes it &quot;usable&quot; but unnecessarily arcane and not c=
onducive to deeper loops - where the latter are presumably why people think=
 they want this in the first place. Sure, they could have it, and then they=
&#39;d have to mentally track how many loops they were currently in. Is tha=
t really a benefit?<br><br></div><div>My vote still goes to the much-malign=
ed goto, which gets excessive flak because the community thinks (probably m=
ostly in their imagination) that noobs are going to do horrible things with=
 it, but it exists precisely for the rest of us to do stuff like this:<br><=
/div><div><span style=3D"font-family:monospace,monospace"><br><code><div><s=
pan style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102=
,0)">(;;)</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"=
color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:rgb(0,0,136)">switch</span><span style=
=3D"color:rgb(102,102,0)">(...)</span><span style=3D"color:rgb(0,0,0)"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">{</span><span sty=
le=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:rgb(0,0,136)">case</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(102,102,0)">...:</span><span style=3D"color:rgb(0=
,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out_of_for</span>=
<span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0=
)"> </span><span style=3D"color:rgb(136,0,0)">// exit the for loop</span><s=
pan style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"colo=
r:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span><span=
 style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><b=
r></span></div></code></span><span style=3D"font-family:monospace,monospace=
"><br></span></div><div><span style=3D"font-family:monospace,monospace">out=
_of_for:<br></span><br></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/c7fc762d-b98a-4d05-9c21-b153b27d8a4b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c7fc762d-b98a-4d05-9c21-b153b27d8a4b=
%40isocpp.org</a>.<br />

------=_Part_287_1993194375.1473939626595--

------=_Part_286_378350843.1473939626595--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Thu, 15 Sep 2016 04:44:28 -0700 (PDT)
Raw View
------=_Part_279_381922809.1473939868404
Content-Type: multipart/alternative;
 boundary="----=_Part_280_17097903.1473939868404"

------=_Part_280_17097903.1473939868404
Content-Type: text/plain; charset=UTF-8

Why not just
{
  DoSomethingUseful();
  if (x == 0)
    break;
  DoSomethingElse();
  if (y == 0)
    break;
  DoAnotherThing();
}

I think additional keyword is redundant here.

On Thursday, September 15, 2016 at 2:40:27 PM UTC+3, Carl Cook wrote:
>
> As a side note, what about a "block" statement? I'd find this useful. It's
> basically a more concise mechanism than do {} while (false);
>
>
> E.g.
>
>
> block
> {
>   DoSomethingUseful();
>   if (x == 0)
>     break;
>   DoSomethingElse();
>   if (y == 0)
>     break;
>   DoAnotherThing();
> }
>
> This way you don't end up with deeply nested if-then-else blocks. It's
> fairly similar to a goto, but without actually being one ;)
>
> Has this been proposed before?
>
> Cheers,
> Carl
>
> On Thursday, 15 September 2016 10:49:03 UTC+2, D. B. wrote:
>>
>> On Thu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <victor.d...@gmail.com>
>> wrote:
>>
>>> Good idea. This makes break usable in code like this:
>>>
>>> for(;;)
>>> {
>>>     switch(...)
>>>     {
>>>         case ...:
>>>             break(2); // exit the for loop
>>>     }
>>> }
>>>
>>>
>>>
>> The point is that it makes it "usable" but unnecessarily arcane and not
>> conducive to deeper loops - where the latter are presumably why people
>> think they want this in the first place. Sure, they could have it, and then
>> they'd have to mentally track how many loops they were currently in. Is
>> that really a benefit?
>>
>> My vote still goes to the much-maligned goto, which gets excessive flak
>> because the community thinks (probably mostly in their imagination) that
>> noobs are going to do horrible things with it, but it exists precisely for
>> the rest of us to do stuff like this:
>>
>> for(;;)
>> {
>>     switch(...)
>>     {
>>         case ...:
>>             goto out_of_for; // exit the for loop
>>     }
>> }
>>
>> out_of_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/f7b4533f-62c2-46c3-9a2b-82da0075dd6c%40isocpp.org.

------=_Part_280_17097903.1473939868404
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Why not just<br><div class=3D"prettyprint" style=3D"backgr=
ound-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-st=
yle: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prett=
yprint"><div class=3D"subprettyprint"><span style=3D"color: #660;" class=3D=
"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 </span><span style=3D"color: #606;" class=3D"styled-=
by-prettify">DoSomethingUseful</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">();</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">if</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">x </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">)</span><span 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">break</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #606;" class=3D"s=
tyled-by-prettify">DoSomethingElse</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">if</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">y </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">)</span><span 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">break</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #606;" clas=
s=3D"styled-by-prettify">DoAnotherThing</span><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"st=
yled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span></div></code></div><div><br>I think additional keyword =
is redundant here.<br></div><br>On Thursday, September 15, 2016 at 2:40:27 =
PM UTC+3, Carl Cook 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"><p dir=3D"ltr" style=3D"font-size:small;font-family:arial,sans=
-serif">As a side note, what about a &quot;block&quot; statement? I&#39;d f=
ind this useful. It&#39;s basically a more concise mechanism than do {} whi=
le (false);</p><p style=3D"font-size:small;font-family:arial,sans-serif"><b=
r></p><p style=3D"font-size:small;font-family:arial,sans-serif">E.g.</p><p =
dir=3D"ltr" style=3D"font-size:small;font-family:arial,sans-serif"><br></p>=
<p dir=3D"ltr" style=3D"font-size:small;font-family:arial,sans-serif"></p><=
div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;backgro=
und-color:rgb(250,250,250)"><code><span style=3D"color:rgb(0,0,0)">block=C2=
=A0<br></span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"c=
olor:rgb(0,0,0)"><br>=C2=A0=C2=A0</span><span style=3D"color:rgb(102,0,102)=
">DoSomethingUseful</span><span style=3D"color:rgb(102,102,0)">();</span><s=
pan style=3D"color:rgb(0,0,0)"><br>=C2=A0=C2=A0</span><span style=3D"color:=
rgb(0,0,136)">if</span><span style=3D"color:rgb(0,0,0)">=C2=A0</span><span =
style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">x</=
span><font color=3D"#666600"><span style=3D"color:rgb(0,0,0)">=C2=A0</span>=
=3D=3D<span style=3D"color:rgb(0,0,0)">=C2=A0</span><span style=3D"color:rg=
b(0,102,102)">0</span>)<span style=3D"color:rgb(0,0,0)"><br></span></font><=
span style=3D"color:rgb(0,0,0)">=C2=A0 =C2=A0=C2=A0</span><span style=3D"co=
lor:rgb(0,0,136)">break</span><span style=3D"color:rgb(102,102,0)">;</span>=
<span style=3D"color:rgb(0,0,0)"><br>=C2=A0=C2=A0</span><span style=3D"colo=
r:rgb(102,0,102)">Do</span><font color=3D"#000000"><span style=3D"color:rgb=
(102,0,102)">SomethingElse</span><span style=3D"color:rgb(102,102,0)">();</=
span></font><span style=3D"color:rgb(0,0,0)"><br>=C2=A0=C2=A0</span><span s=
tyle=3D"color:rgb(0,0,136)">if</span><span style=3D"color:rgb(0,0,0)">=C2=
=A0</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color=
:rgb(0,0,0)">y=C2=A0</span><span style=3D"color:rgb(102,102,0)">=3D=3D</spa=
n><span style=3D"color:rgb(0,0,0)">=C2=A0</span><span style=3D"color:rgb(0,=
102,102)">0</span><span style=3D"color:rgb(102,102,0)">)</span><span style=
=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0=C2=A0</span><span style=3D"color:rg=
b(0,0,136)">break</span><span style=3D"color:rgb(102,102,0)">;</span><span =
style=3D"color:rgb(0,0,0)"><br>=C2=A0 DoAnotherThing();</span><span style=
=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">}</sp=
an></code></div><div><br></div><div>This way you don&#39;t end up with deep=
ly nested if-then-else blocks. It&#39;s fairly similar to a goto, but witho=
ut actually being one ;)</div><div><br></div><div>Has this been proposed be=
fore?</div><div><br></div><div>Cheers,</div><div>Carl</div><br>On Thursday,=
 15 September 2016 10:49:03 UTC+2, D. B.  wrote:<blockquote class=3D"gmail_=
quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;paddi=
ng-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote">On Thu, Sep 1=
5, 2016 at 8:40 AM, Victor Dyachenko <span dir=3D"ltr">&lt;<a rel=3D"nofoll=
ow">victor.d...@gmail.com</a>&gt;</span> wrote:<br><blockquote style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex" class=3D"gmail_quote"><div dir=3D"ltr">Good idea. This makes <span styl=
e=3D"font-family:courier new,monospace">break</span> usable in code like th=
is:<br><br><div style=3D"background-color:rgb(250,250,250);border-color:rgb=
(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><co=
de><div><span style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:r=
gb(102,102,0)">(;;)</span><span style=3D"color:rgb(0,0,0)"><br></span><span=
 style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">switch</span><spa=
n style=3D"color:rgb(102,102,0)">(...)</span><span style=3D"color:rgb(0,0,0=
)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">{</span><s=
pan style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span=
 style=3D"color:rgb(0,0,136)">case</span><span style=3D"color:rgb(0,0,0)"> =
</span><span style=3D"color:rgb(102,102,0)">...:</span><span style=3D"color=
:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span sty=
le=3D"color:rgb(0,0,136)">break</span><span style=3D"color:rgb(102,102,0)">=
(</span><span style=3D"color:rgb(0,102,102)">2</span><span style=3D"color:r=
gb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(136,0,0)">// exit the for loop</span><span style=3D"color:rg=
b(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">}</=
span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(1=
02,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br><br></span></div></=
code></div><br></div></blockquote></div><br></div><div>The point is that it=
 makes it &quot;usable&quot; but unnecessarily arcane and not conducive to =
deeper loops - where the latter are presumably why people think they want t=
his in the first place. Sure, they could have it, and then they&#39;d have =
to mentally track how many loops they were currently in. Is that really a b=
enefit?<br><br></div><div>My vote still goes to the much-maligned goto, whi=
ch gets excessive flak because the community thinks (probably mostly in the=
ir imagination) that noobs are going to do horrible things with it, but it =
exists precisely for the rest of us to do stuff like this:<br></div><div><s=
pan style=3D"font-family:monospace,monospace"><br><code><div><span style=3D=
"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">(;;)</s=
pan><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(10=
2,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span=
><span style=3D"color:rgb(0,0,136)">switch</span><span style=3D"color:rgb(1=
02,102,0)">(...)</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb=
(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,=
0,136)">case</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"=
color:rgb(102,102,0)">...:</span><span style=3D"color:rgb(0,0,0)"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out_of_for</span><span style=3D=
"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"> </span><sp=
an style=3D"color:rgb(136,0,0)">// exit the for loop</span><span style=3D"c=
olor:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,=
0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"colo=
r:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span></div=
></code></span><span style=3D"font-family:monospace,monospace"><br></span><=
/div><div><span style=3D"font-family:monospace,monospace">out_of_for:<br></=
span><br></div></div>
</blockquote></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/f7b4533f-62c2-46c3-9a2b-82da0075dd6c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f7b4533f-62c2-46c3-9a2b-82da0075dd6c=
%40isocpp.org</a>.<br />

------=_Part_280_17097903.1473939868404--

------=_Part_279_381922809.1473939868404--

.


Author: Carl Cook <carl.cook@gmail.com>
Date: Thu, 15 Sep 2016 13:49:32 +0200
Raw View
--94eb2c1941129f941a053c8a7129
Content-Type: text/plain; charset=UTF-8

Break statements need to be within a loop or switch, right?


On 15 September 2016 at 13:44, Victor Dyachenko <victor.dyachenko@gmail.com>
wrote:

> Why not just
> {
>   DoSomethingUseful();
>   if (x == 0)
>     break;
>   DoSomethingElse();
>   if (y == 0)
>     break;
>   DoAnotherThing();
> }
>
> I think additional keyword is redundant here.
>
> On Thursday, September 15, 2016 at 2:40:27 PM UTC+3, Carl Cook wrote:
>>
>> As a side note, what about a "block" statement? I'd find this useful.
>> It's basically a more concise mechanism than do {} while (false);
>>
>>
>> E.g.
>>
>>
>> block
>> {
>>   DoSomethingUseful();
>>   if (x == 0)
>>     break;
>>   DoSomethingElse();
>>   if (y == 0)
>>     break;
>>   DoAnotherThing();
>> }
>>
>> This way you don't end up with deeply nested if-then-else blocks. It's
>> fairly similar to a goto, but without actually being one ;)
>>
>> Has this been proposed before?
>>
>> Cheers,
>> Carl
>>
>> On Thursday, 15 September 2016 10:49:03 UTC+2, D. B. wrote:
>>>
>>> On Thu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <victor.d...@gmail.com
>>> > wrote:
>>>
>>>> Good idea. This makes break usable in code like this:
>>>>
>>>> for(;;)
>>>> {
>>>>     switch(...)
>>>>     {
>>>>         case ...:
>>>>             break(2); // exit the for loop
>>>>     }
>>>> }
>>>>
>>>>
>>>>
>>> The point is that it makes it "usable" but unnecessarily arcane and not
>>> conducive to deeper loops - where the latter are presumably why people
>>> think they want this in the first place. Sure, they could have it, and then
>>> they'd have to mentally track how many loops they were currently in. Is
>>> that really a benefit?
>>>
>>> My vote still goes to the much-maligned goto, which gets excessive flak
>>> because the community thinks (probably mostly in their imagination) that
>>> noobs are going to do horrible things with it, but it exists precisely for
>>> the rest of us to do stuff like this:
>>>
>>> for(;;)
>>> {
>>>     switch(...)
>>>     {
>>>         case ...:
>>>             goto out_of_for; // exit the for loop
>>>     }
>>> }
>>>
>>> out_of_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/f7b4533f-62c2-46c3-
> 9a2b-82da0075dd6c%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f7b4533f-62c2-46c3-9a2b-82da0075dd6c%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/CAGa0LWvyKDfeRFYzYtK_%3DsMS%2BS-%2BrXbc0uHjtzEdU__opnO73w%40mail.gmail.com.

--94eb2c1941129f941a053c8a7129
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Break statements need to be within a loop or switch, right=
?<div><br></div></div><div class=3D"gmail_extra"><br><div class=3D"gmail_qu=
ote">On 15 September 2016 at 13:44, Victor Dyachenko <span dir=3D"ltr">&lt;=
<a href=3D"mailto:victor.dyachenko@gmail.com" target=3D"_blank">victor.dyac=
henko@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" =
style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><di=
v dir=3D"ltr">Why not just<span class=3D""><br><div style=3D"background-col=
or:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border=
-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#660">{</s=
pan><span style=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#606"=
>DoSomethingUseful</span><span style=3D"color:#660">();</span><span style=
=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#008">if</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#660">(</span><span styl=
e=3D"color:#000">x </span><span style=3D"color:#660">=3D=3D</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#066">0</span><span style=3D=
"color:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color:#008">break</span><span style=3D"color:#660">;</span><sp=
an style=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#606">DoSome=
thingElse</span><span style=3D"color:#660">();</span><span style=3D"color:#=
000"><br>=C2=A0 </span><span style=3D"color:#008">if</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">(</span><span style=3D"color:=
#000">y </span><span style=3D"color:#660">=3D=3D</span><span style=3D"color=
:#000"> </span><span style=3D"color:#066">0</span><span style=3D"color:#660=
">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#008">break</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#606">DoAnotherThing=
</span><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=
</span><span style=3D"color:#660">}</span><span style=3D"color:#000"><br></=
span></div></code></div></span><div><br>I think additional keyword is redun=
dant here.<br></div><div><div class=3D"h5"><br>On Thursday, September 15, 2=
016 at 2:40:27 PM UTC+3, Carl Cook 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"><p dir=3D"ltr" style=3D"font-size:small;font-family:=
arial,sans-serif">As a side note, what about a &quot;block&quot; statement?=
 I&#39;d find this useful. It&#39;s basically a more concise mechanism than=
 do {} while (false);</p><p style=3D"font-size:small;font-family:arial,sans=
-serif"><br></p><p style=3D"font-size:small;font-family:arial,sans-serif">E=
..g.</p><p dir=3D"ltr" style=3D"font-size:small;font-family:arial,sans-serif=
"><br></p><p dir=3D"ltr" style=3D"font-size:small;font-family:arial,sans-se=
rif"></p><div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-wo=
rd;background-color:rgb(250,250,250)"><code><span style=3D"color:rgb(0,0,0)=
">block=C2=A0<br></span><span style=3D"color:rgb(102,102,0)">{</span><span =
style=3D"color:rgb(0,0,0)"><br>=C2=A0=C2=A0</span><span style=3D"color:rgb(=
102,0,102)">DoSomethingUseful</span><span style=3D"color:rgb(102,102,0)">()=
;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0=C2=A0</span><span style=
=3D"color:rgb(0,0,136)">if</span><span style=3D"color:rgb(0,0,0)">=C2=A0</s=
pan><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0=
,0,0)">x</span><font color=3D"#666600"><span style=3D"color:rgb(0,0,0)">=C2=
=A0</span>=3D=3D<span style=3D"color:rgb(0,0,0)">=C2=A0</span><span style=
=3D"color:rgb(0,102,102)">0</span>)<span style=3D"color:rgb(0,0,0)"><br></s=
pan></font><span style=3D"color:rgb(0,0,0)">=C2=A0 =C2=A0=C2=A0</span><span=
 style=3D"color:rgb(0,0,136)">break</span><span style=3D"color:rgb(102,102,=
0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0=C2=A0</span><span s=
tyle=3D"color:rgb(102,0,102)">Do</span><font color=3D"#000000"><span style=
=3D"color:rgb(102,0,102)">SomethingElse</span><span style=3D"color:rgb(102,=
102,0)">();</span></font><span style=3D"color:rgb(0,0,0)"><br>=C2=A0=C2=A0<=
/span><span style=3D"color:rgb(0,0,136)">if</span><span style=3D"color:rgb(=
0,0,0)">=C2=A0</span><span style=3D"color:rgb(102,102,0)">(</span><span sty=
le=3D"color:rgb(0,0,0)">y=C2=A0</span><span style=3D"color:rgb(102,102,0)">=
=3D=3D</span><span style=3D"color:rgb(0,0,0)">=C2=A0</span><span style=3D"c=
olor:rgb(0,102,102)">0</span><span style=3D"color:rgb(102,102,0)">)</span><=
span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0=C2=A0</span><span style=
=3D"color:rgb(0,0,136)">break</span><span style=3D"color:rgb(102,102,0)">;<=
/span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 DoAnotherThing();</span><=
span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102=
,0)">}</span></code></div><div><br></div><div>This way you don&#39;t end up=
 with deeply nested if-then-else blocks. It&#39;s fairly similar to a goto,=
 but without actually being one ;)</div><div><br></div><div>Has this been p=
roposed before?</div><div><br></div><div>Cheers,</div><div>Carl</div><br>On=
 Thursday, 15 September 2016 10:49:03 UTC+2, D. B.  wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote">On =
Thu, Sep 15, 2016 at 8:40 AM, Victor Dyachenko <span dir=3D"ltr">&lt;<a rel=
=3D"nofollow">victor.d...@gmail.com</a>&gt;</span> wrote:<br><blockquote st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex" class=3D"gmail_quote"><div dir=3D"ltr">Good idea. This makes =
<span style=3D"font-family:courier new,monospace">break</span> usable in co=
de like this:<br><br><div style=3D"background-color:rgb(250,250,250);border=
-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break=
-word"><code><div><span style=3D"color:rgb(0,0,136)">for</span><span style=
=3D"color:rgb(102,102,0)">(;;)</span><span style=3D"color:rgb(0,0,0)"><br><=
/span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb=
(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">switch=
</span><span style=3D"color:rgb(102,102,0)">(...)</span><span style=3D"colo=
r:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)"=
>{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <=
/span><span style=3D"color:rgb(0,0,136)">case</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">...:</span><span sty=
le=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </spa=
n><span style=3D"color:rgb(0,0,136)">break</span><span style=3D"color:rgb(1=
02,102,0)">(</span><span style=3D"color:rgb(0,102,102)">2</span><span style=
=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(136,0,0)">// exit the for loop</span><span style=
=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102=
,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D=
"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br><br></s=
pan></div></code></div><br></div></blockquote></div><br></div><div>The poin=
t is that it makes it &quot;usable&quot; but unnecessarily arcane and not c=
onducive to deeper loops - where the latter are presumably why people think=
 they want this in the first place. Sure, they could have it, and then they=
&#39;d have to mentally track how many loops they were currently in. Is tha=
t really a benefit?<br><br></div><div>My vote still goes to the much-malign=
ed goto, which gets excessive flak because the community thinks (probably m=
ostly in their imagination) that noobs are going to do horrible things with=
 it, but it exists precisely for the rest of us to do stuff like this:<br><=
/div><div><span style=3D"font-family:monospace,monospace"><br><code><div><s=
pan style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102=
,0)">(;;)</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"=
color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:rgb(0,0,136)">switch</span><span style=
=3D"color:rgb(102,102,0)">(...)</span><span style=3D"color:rgb(0,0,0)"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">{</span><span sty=
le=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:rgb(0,0,136)">case</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(102,102,0)">...:</span><span style=3D"color:rgb(0=
,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out_of_for</span>=
<span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0=
)"> </span><span style=3D"color:rgb(136,0,0)">// exit the for loop</span><s=
pan style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"colo=
r:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span><span=
 style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><b=
r></span></div></code></span><span style=3D"font-family:monospace,monospace=
"><br></span></div><div><span style=3D"font-family:monospace,monospace">out=
_of_for:<br></span><br></div></div>
</blockquote></div></blockquote></div></div></div><div><div class=3D"h5">

<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@<wbr>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></div></div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f7b4533f-62c2-46c3-9a2b-82da0075dd6c%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/f7b4=
533f-62c2-46c3-<wbr>9a2b-82da0075dd6c%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></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/CAGa0LWvyKDfeRFYzYtK_%3DsMS%2BS-%2BrX=
bc0uHjtzEdU__opnO73w%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGa0LWvyKD=
feRFYzYtK_%3DsMS%2BS-%2BrXbc0uHjtzEdU__opnO73w%40mail.gmail.com</a>.<br />

--94eb2c1941129f941a053c8a7129--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Thu, 15 Sep 2016 04:54:35 -0700 (PDT)
Raw View
------=_Part_134_625164341.1473940475314
Content-Type: multipart/alternative;
 boundary="----=_Part_135_921531479.1473940475314"

------=_Part_135_921531479.1473940475314
Content-Type: text/plain; charset=UTF-8

On Thursday, September 15, 2016 at 2:50:02 PM UTC+3, Carl Cook wrote:
>
> Break statements need to be within a loop or switch, right?
>

Yes, but you are trying to propose new feature. Aren't you?

--
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/a0f57f44-a17f-49e7-b263-13a4e84f70fa%40isocpp.org.

------=_Part_135_921531479.1473940475314
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, September 15, 2016 at 2:50:02 PM UTC+3, Carl =
Cook 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">Br=
eak statements need to be within a loop or switch, right?</div></blockquote=
><div><br>Yes, but you are trying to propose new feature. Aren&#39;t you?<b=
r></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/a0f57f44-a17f-49e7-b263-13a4e84f70fa%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a0f57f44-a17f-49e7-b263-13a4e84f70fa=
%40isocpp.org</a>.<br />

------=_Part_135_921531479.1473940475314--

------=_Part_134_625164341.1473940475314--

.


Author: Carl Cook <carl.cook@gmail.com>
Date: Thu, 15 Sep 2016 13:57:08 +0200
Raw View
--94eb2c194112d602d0053c8a8ca4
Content-Type: text/plain; charset=UTF-8

>
> Break statements need to be within a loop or switch, right?
>>
>
> Yes, but you are trying to propose new feature. Aren't you?
>

Only if it's a good idea.

I see what you are saying now... indeed the "block" statement is redundant,
and such a feature would not introduce any breaking changes (pun intended).

--
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/CAGa0LWuVN5aCqFKfqsrf88m5Xx7EdgW%2BNyk8--ZZyXg-%3DogeZA%40mail.gmail.com.

--94eb2c194112d602d0053c8a8ca4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr"><span class=3D""><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr">Break statements need to be with=
in a loop or switch, right?</div></blockquote></span><div><br>Yes, but you =
are trying to propose new feature. Aren&#39;t you?<br></div></div></blockqu=
ote><div><br></div><div>Only if it&#39;s a good idea.</div><div><br></div><=
div>I see what you are saying now... indeed the &quot;block&quot; statement=
 is redundant, and such a feature would not introduce any breaking changes =
(pun intended).</div><div><br></div></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/CAGa0LWuVN5aCqFKfqsrf88m5Xx7EdgW%2BNy=
k8--ZZyXg-%3DogeZA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGa0LWuVN5aC=
qFKfqsrf88m5Xx7EdgW%2BNyk8--ZZyXg-%3DogeZA%40mail.gmail.com</a>.<br />

--94eb2c194112d602d0053c8a8ca4--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Thu, 15 Sep 2016 05:03:19 -0700 (PDT)
Raw View
------=_Part_294_756375850.1473940999405
Content-Type: multipart/alternative;
 boundary="----=_Part_295_1745175904.1473940999405"

------=_Part_295_1745175904.1473940999405
Content-Type: text/plain; charset=UTF-8

On Thursday, September 15, 2016 at 2:57:34 PM UTC+3, Carl Cook wrote:
>
>
> I see what you are saying now... indeed the "block" statement is
> redundant, and such a feature would not introduce any breaking changes (pun
> intended).
>
> Exactly. I find it useful feature - exit from the current block or loop
(which body may not be a block, just one expression statement).

--
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/f273267a-c00d-482b-bf8f-9e7790e08a95%40isocpp.org.

------=_Part_295_1745175904.1473940999405
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, September 15, 2016 at 2:57:34 PM UTC+3, Carl =
Cook 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"><d=
iv><div class=3D"gmail_quote"><br><div>I see what you are saying now... ind=
eed the &quot;block&quot; statement is redundant, and such a feature would =
not introduce any breaking changes (pun intended).</div><div><br></div></di=
v></div></div></blockquote><div>Exactly. I find it useful feature - exit fr=
om the current block or loop (which body may not be a block, just one expre=
ssion statement).<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/f273267a-c00d-482b-bf8f-9e7790e08a95%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f273267a-c00d-482b-bf8f-9e7790e08a95=
%40isocpp.org</a>.<br />

------=_Part_295_1745175904.1473940999405--

------=_Part_294_756375850.1473940999405--

.


Author: Alexey Mamontov <caracrist@gmail.com>
Date: Thu, 15 Sep 2016 05:26:01 -0700 (PDT)
Raw View
------=_Part_329_698392103.1473942361620
Content-Type: multipart/alternative;
 boundary="----=_Part_330_183846914.1473942361621"

------=_Part_330_183846914.1473942361621
Content-Type: text/plain; charset=UTF-8


 while ( cond1 )
 {
        while ( cond2 )
        {
            if ( cond3 )
            {
                break, break;
            }
            else if ( cond4)
            {
                break, continue;
            }
        }
        // code reached only if !cond2
 }


Why is it good:
* We use the comma operator in its intuitive manner
* IDE can highlight related keywords
* It doesn't make it comfortable to create many embedded loops
* Allows to continue as the last operation (nice bonus)

--
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/84a77953-6cb8-4c3c-9cd3-6dccf46934b2%40isocpp.org.

------=_Part_330_183846914.1473942361621
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><code class=3D"prettyprint"><div class=3D"prettyprint" sty=
le=3D"border: 1px solid rgb(187, 187, 187); border-image: none; -ms-word-wr=
ap: break-word; background-color: rgb(250, 250, 250);"><div class=3D"subpre=
ttyprint"><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"=
><br>=C2=A0</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0,=
 0, 136);">while</span><span class=3D"styled-by-prettify" style=3D"color: r=
gb(0, 0, 0);"> </span><span class=3D"styled-by-prettify" style=3D"color: rg=
b(102, 102, 0);">(</span><span class=3D"styled-by-prettify" style=3D"color:=
 rgb(0, 0, 0);"> cond1 </span><span class=3D"styled-by-prettify" style=3D"c=
olor: rgb(102, 102, 0);">)</span><span class=3D"styled-by-prettify" style=
=3D"color: rgb(0, 0, 0);"><br>=C2=A0</span><span class=3D"styled-by-prettif=
y" style=3D"color: rgb(102, 102, 0);">{</span><span class=3D"styled-by-pret=
tify" style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span=
><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">while<=
/span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </=
span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">=
(</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> =
cond2 </span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 10=
2, 0);">)</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0=
, 0);"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span class=3D"styled-by-pret=
tify" style=3D"color: rgb(102, 102, 0);">{</span><span class=3D"styled-by-p=
rettify" style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span class=3D"styled-by-prettify" style=3D"color: rgb(0,=
 0, 136);">if</span><span class=3D"styled-by-prettify" style=3D"color: rgb(=
0, 0, 0);"> </span><span class=3D"styled-by-prettify" style=3D"color: rgb(1=
02, 102, 0);">(</span><span class=3D"styled-by-prettify" style=3D"color: rg=
b(0, 0, 0);"> cond3 </span><span class=3D"styled-by-prettify" style=3D"colo=
r: rgb(102, 102, 0);">)</span><span class=3D"styled-by-prettify" style=3D"c=
olor: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><=
span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">{</spa=
n><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span class=3D"=
styled-by-prettify" style=3D"color: rgb(0, 0, 136);">break</span><span clas=
s=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">,</span><span c=
lass=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">break</span><sp=
an class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">;</span>=
<span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span class=3D"styled-by-pret=
tify" style=3D"color: rgb(102, 102, 0);">}</span><span class=3D"styled-by-p=
rettify" style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span class=3D"styled-by-prettify" style=3D"color: rgb(0,=
 0, 136);">else</span><span class=3D"styled-by-prettify" style=3D"color: rg=
b(0, 0, 0);"> </span><span class=3D"styled-by-prettify" style=3D"color: rgb=
(0, 0, 136);">if</span><span class=3D"styled-by-prettify" style=3D"color: r=
gb(0, 0, 0);"> </span><span class=3D"styled-by-prettify" style=3D"color: rg=
b(102, 102, 0);">(</span><span class=3D"styled-by-prettify" style=3D"color:=
 rgb(0, 0, 0);"> cond4</span><span class=3D"styled-by-prettify" style=3D"co=
lor: rgb(102, 102, 0);">)</span><span class=3D"styled-by-prettify" style=3D=
"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span=
><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">{</s=
pan><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">break</span><span =
class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">,</span><sp=
an class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"> </span><spa=
n class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">continue</s=
pan><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">;=
</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><b=
r></span><font color=3D"#000000"><span class=3D"styled-by-prettify" style=
=3D"color: rgb(0, 0, 0);">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span>=
</font><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);=
">}</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span class=3D"styled-by-prettify" =
style=3D"color: rgb(102, 102, 0);">}</span><span class=3D"styled-by-prettif=
y" style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><s=
pan class=3D"styled-by-prettify" style=3D"color: rgb(136, 0, 0);">// code r=
eached only if !</span><font color=3D"#000000"><span class=3D"styled-by-pre=
ttify" style=3D"color: rgb(136, 0, 0);">cond2</span></font><span class=3D"s=
tyled-by-prettify" style=3D"color: rgb(0, 0, 0);"><br>=C2=A0</span><span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">}</span><span=
 class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><br><br></span=
></div></div></code><div class=3D"prettyprint" style=3D"border: 1px solid r=
gb(187, 187, 187); border-image: none; -ms-word-wrap: break-word; backgroun=
d-color: rgb(250, 250, 250);"></div><div><br></div><div>Why is it good:</di=
v><div>* We use the comma operator in its=C2=A0intuitive manner</div><div>*=
 IDE can highlight related keywords</div><div>* It doesn&#39;t make it comf=
ortable to create many embedded loops</div><div>* Allows to continue as the=
 last operation (nice bonus)</div><div><br></div></div>

<p></p>

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

------=_Part_330_183846914.1473942361621--

------=_Part_329_698392103.1473942361620--

.


Author: Moritz Klammler <moritz.klammler@gmail.com>
Date: Thu, 15 Sep 2016 18:59:17 +0200
Raw View
Victor Dyachenko <victor.dyachenko@gmail.com> writes:

> Why not just
> {
>   DoSomethingUseful();
>   if (x == 0)
>     break;
>   DoSomethingElse();
>   if (y == 0)
>     break;
>   DoAnotherThing();
> }
>
> I think additional keyword is redundant here.

I don't think that this is going to work.

Consider the following code, which is valid and obvious in every version
of C++.

    while (more_stuff_to_do())
      {
        if (tired_of_doing_stuff())
          {
            if (boss_is_not_here())
              break;  // Where should control flow be transferred?
            std::cout << "Okay, I'll keep going...\n";
          }
      }

And even if you invent a (presumably not very intuitive) rule for how
this case would be handled, you would still break *lots* of existing
code like this.

    while (true)
      {
        std::unique_ptr<thing> mything{};
        // Nested scope is used because of the RAII lock.
        {
          std::lock_guard lg{mymutex};
          if (queue.empty())
            break;  // Intention is to break out of the while loop.
          mything = queue.pop();
        }
        // Work with my thing...
      }

--
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/87poo5nlp6.fsf%40gmail.com.

.


Author: "D. B." <db0451@gmail.com>
Date: Thu, 15 Sep 2016 18:10:47 +0100
Raw View
--e89a8f3ba1f55a1428053c8eedb4
Content-Type: text/plain; charset=UTF-8

On Thu, Sep 15, 2016 at 1:26 PM, Alexey Mamontov <caracrist@gmail.com>
wrote:

>
>  while ( cond1 )
>  {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 break, break;
>             }
>             else if ( cond4)
>             {
>                 break, continue;
>             }
>         }
>         // code reached only if !cond2
>  }
>
>
> Why is it good:
> * We use the comma operator in its intuitive manner
>

I don't have anything fundamentally against this syntax, but I wouldn't say
it's intuitive/familiar, since it introduces yet another new overload for
the comma.



> * It doesn't make it comfortable to create many embedded loops
> * Allows to continue as the last operation (nice bonus)
>
> These are indeed benefits, if we 'must' have any feature like this -
especially the one that discourages it ;-)

--
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/CACGiwhHL%2Bfqc_K5qJrYUwJKBf8XWFRacxNx-G%3D-SRE5LRJVvMQ%40mail.gmail.com.

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

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On Thu, Sep 15, 2016 at 1:26 PM, Alexey Mamontov <span dir=3D"ltr">&lt;<a h=
ref=3D"mailto:caracrist@gmail.com" target=3D"_blank">caracrist@gmail.com</a=
>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 =
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><cod=
e><div style=3D"border:1px solid rgb(187,187,187);background-color:rgb(250,=
250,250)"><div><span class=3D""><span style=3D"color:rgb(0,0,0)"><br>=C2=A0=
</span><span style=3D"color:rgb(0,0,136)">while</span><span style=3D"color:=
rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">(</span><span styl=
e=3D"color:rgb(0,0,0)"> cond1 </span><span style=3D"color:rgb(102,102,0)">)=
</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0</span><span style=3D"col=
or:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">while</span><sp=
an style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">=
(</span><span style=3D"color:rgb(0,0,0)"> cond2 </span><span style=3D"color=
:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">{</span><span st=
yle=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </sp=
an><span style=3D"color:rgb(0,0,136)">if</span><span style=3D"color:rgb(0,0=
,0)"> </span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"co=
lor:rgb(0,0,0)"> cond3 </span><span style=3D"color:rgb(102,102,0)">)</span>=
<span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:rgb(102,102,0)">{</span></span><span style=
=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span><span style=3D"color:rgb(0,0,136)">break</span><span style=3D=
"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span><sp=
an style=3D"color:rgb(0,0,136)">break</span><span style=3D"color:rgb(102,10=
2,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><span=
 style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <=
/span><span style=3D"color:rgb(0,0,136)">else</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)">if</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">(</span>=
<span style=3D"color:rgb(0,0,0)"> cond4</span><span style=3D"color:rgb(102,=
102,0)">)</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">{</span><s=
pan style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">break</span><sp=
an style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)">=
 </span><span style=3D"color:rgb(0,0,136)">continue</span><span style=3D"co=
lor:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br></span><fo=
nt color=3D"#000000"><span style=3D"color:rgb(0,0,0)">=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span></font><span style=3D"color:rgb(102,102,0)">}</=
span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </spa=
n><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0=
,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(136,0,=
0)">// code reached only if !</span><font color=3D"#000000"><span style=3D"=
color:rgb(136,0,0)">cond2</span></font><span style=3D"color:rgb(0,0,0)"><br=
>=C2=A0</span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"c=
olor:rgb(0,0,0)"><br><br></span></div></div></code><div style=3D"border:1px=
 solid rgb(187,187,187);background-color:rgb(250,250,250)"></div><div><br><=
/div><div>Why is it good:</div><div>* We use the comma operator in its=C2=
=A0intuitive manner</div></div></blockquote><br></div><div class=3D"gmail_q=
uote">I don&#39;t have anything fundamentally against this syntax, but I wo=
uldn&#39;t say it&#39;s intuitive/familiar, since it introduces yet another=
 new overload for the comma. <br></div><div class=3D"gmail_quote"><div><br>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>* It doesn=
&#39;t make it comfortable to create many embedded loops</div><div>* Allows=
 to continue as the last operation (nice bonus)</div><br></div></blockquote=
><div>These are indeed benefits, if we &#39;must&#39; have any feature like=
 this - especially the one that discourages it ;-)<br>=C2=A0<br></div></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/CACGiwhHL%2Bfqc_K5qJrYUwJKBf8XWFRacxN=
x-G%3D-SRE5LRJVvMQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhHL%2Bf=
qc_K5qJrYUwJKBf8XWFRacxNx-G%3D-SRE5LRJVvMQ%40mail.gmail.com</a>.<br />

--e89a8f3ba1f55a1428053c8eedb4--

.


Author: Magnus Fromreide <magfr@lysator.liu.se>
Date: Thu, 15 Sep 2016 19:18:04 +0200
Raw View
On Thu, Sep 15, 2016 at 05:26:01AM -0700, Alexey Mamontov wrote:
>
>  while ( cond1 )
>  {
>         while ( cond2 )
>         {
>             if ( cond3 )
>             {
>                 break, break;
>             }
>             else if ( cond4)
>             {
>                 break, continue;
>             }
>         }
>         // code reached only if !cond2
>  }
>
>
> Why is it good:
> * We use the comma operator in its intuitive manner
> * IDE can highlight related keywords
> * It doesn't make it comfortable to create many embedded loops
> * Allows to continue as the last operation (nice bonus)

Is this general statement stacking?

Should

break, throw x;

mean that you should leave the innermost loop and then throw?

Should

return 17, break;

mean 'Return from this function and break out of the current loop or switch
in the calling function'?

/MF

--
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/20160915171803.GA17056%40fukushima.lysator.liu.se.

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Thu, 15 Sep 2016 23:52:29 -0700 (PDT)
Raw View
------=_Part_1202_1014300761.1474008750103
Content-Type: multipart/alternative;
 boundary="----=_Part_1203_407205853.1474008750104"

------=_Part_1203_407205853.1474008750104
Content-Type: text/plain; charset=UTF-8

On Thursday, September 15, 2016 at 7:59:23 PM UTC+3, Moritz Klammler wrote:
>
> I don't think that this is going to work.
>
> Consider the following code, which is valid and obvious in every version
> of C++.
>
>     while (more_stuff_to_do())
>       {
>         if (tired_of_doing_stuff())
>           {
>             if (boss_is_not_here())
>               break;  // Where should control flow be transferred?
>             std::cout << "Okay, I'll keep going...\n";
>           }
>       }
>
> And even if you invent a (presumably not very intuitive) rule for how
> this case would be handled, you would still break *lots* of existing
> code like this.
>

On Thursday, September 15, 2016 at 3:03:19 PM UTC+3, Victor Dyachenko
wrote:

> exit from the current block or loop (which body may not be a block, just
> one expression statement).
>


>     while (true)
>       {
>         std::unique_ptr<thing> mything{};
>         // Nested scope is used because of the RAII lock.
>         {
>           std::lock_guard lg{mymutex};
>           if (queue.empty())
>             break;  // Intention is to break out of the while loop.
>           mything = queue.pop();
>         }
>         // Work with my thing...
>       }
>
Yes, this case is broken... :-(

--
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/0c54e909-4826-4395-9327-87a3c81e75a8%40isocpp.org.

------=_Part_1203_407205853.1474008750104
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, September 15, 2016 at 7:59:23 PM UTC+3, Morit=
z Klammler wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">I don&#39;t t=
hink that this is going to work.
<br>
<br>Consider the following code, which is valid and obvious in every versio=
n
<br>of C++.
<br>
<br>=C2=A0 =C2=A0 while (more_stuff_to_do())
<br>=C2=A0 =C2=A0 =C2=A0 {
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (tired_of_doing_stuff())
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (boss_is_not_here())
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; =C2=A0// Where =
should control flow be transferred?
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::cout &lt;&lt; &quot;Okay=
, I&#39;ll keep going...\n&quot;;
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
<br>=C2=A0 =C2=A0 =C2=A0 }
<br>
<br>And even if you invent a (presumably not very intuitive) rule for how
<br>this case would be handled, you would still break *lots* of existing
<br>code like this.
<br>
</blockquote><div><div><br>On Thursday, September 15, 2016 at 3:03:19 PM UT=
C+3, Victor Dyachenko wrote: <br></div><blockquote style=3D"margin: 0px 0px=
 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" =
class=3D"gmail_quote">exit from the current block or loop (which body may n=
ot be a block, just one expression statement).<br></blockquote>=C2=A0</div>=
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;">=C2=A0 =C2=A0 while (true)
<br>=C2=A0 =C2=A0 =C2=A0 {
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std::unique_ptr&lt;thing&gt; mything{};
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Nested scope is used because of the RAII=
 lock.
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::lock_guard lg{mymutex};
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (queue.empty())
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; =C2=A0// Intention is =
to break out of the while loop.
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mything =3D queue.pop();
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Work with my thing...
<br>=C2=A0 =C2=A0 =C2=A0 }
<br></blockquote><div>Yes, this case is broken... :-( <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/0c54e909-4826-4395-9327-87a3c81e75a8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0c54e909-4826-4395-9327-87a3c81e75a8=
%40isocpp.org</a>.<br />

------=_Part_1203_407205853.1474008750104--

------=_Part_1202_1014300761.1474008750103--

.


Author: "michaeldavies32 via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 16 Sep 2016 02:40:35 -0700 (PDT)
Raw View
------=_Part_1318_1252223005.1474018835513
Content-Type: multipart/alternative;
 boundary="----=_Part_1319_462752108.1474018835513"

------=_Part_1319_462752108.1474018835513
Content-Type: text/plain; charset=UTF-8



On Wednesday, September 14, 2016 at 4:37:12 PM UTC+1, amg...@gmail.com
wrote:
>
> while ( there are ppl wants to complicate things )
> {
>      while( they want to define labels and write more than necessary )
>      {
>  break2; // make your life simpler
>      }
> }
>
> With regards to your solution 1 in the original OP of using a function and
> then calling return. You say it is elegant but slow. Because of the time
> you need to take to create a function? If that is such an issue why not
> just do an immediately invoked lambda expression which was one of Jason
> Turner's key points at boostcon:
>
> [&](){
>   while ( cond1 )
>         {
>             while ( cond2 )
>             {
>                 if ( cond3 )
>                 {
>       return;
>                 }
>             }
>         }
> }();
>

> Really though, if you're going to have such complexity within your
> program, with it to be iterating through several loops, it would be better
> for you to separate it out into its own method or function function and
> give it a meaningful name. I've seen many talks from the likes of Herb
> Sutter, Sean Parent and Bjarne Stroustrup on the subject of reducing the
> complexity of your code and making it intuitive to read by dividing up the
> problem and giving each area of the code its own name. For these reasons,
> while I do see why you want break(n), solution 1 is probably the most
> acceptable way to handle this issue. Regardless of the extra time incurred
> in creating the new method/function. And
>
> On Tuesday, September 13, 2016 at 1:00:03 AM UTC+2, Hyman Rosen wrote:
>>
>> And the labeled break is superior to both:
>>
>> outer: for (auto&& person : people) {
>>     inner: for (auto&& phone : person.phones) {
>>         if (isLandline(phone)) {
>>             std::cout << person.name << " " << phone
>>                       << " still uses landline, do not switch it off!"
>>                       << std::endl;
>>             break outer;
>>         }
>>     }
>> }
>>
>> The label is seen before the statement that uses it, and break and
>> continue statements are already "grokked" by programmers of C-derived
>> languages.  That means readers of the code don't have to worry about where
>> a goto is going.  That's why they invented structured programming, after
>> all.
>>
>

--
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/b81fcc0a-9a48-4afb-a9ef-798467c08925%40isocpp.org.

------=_Part_1319_462752108.1474018835513
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, September 14, 2016 at 4:37:12 PM UTC=
+1, amg...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"ltr"><div>while ( there are ppl wants to complicate things )<br></=
div><div>{</div><div>=C2=A0 =C2=A0 =C2=A0while( they want to define labels =
and write more than necessary )</div><div>=C2=A0 =C2=A0 =C2=A0{</div><div><=
span style=3D"white-space:pre"> </span> =C2=A0break2; // make your life sim=
pler</div><div>=C2=A0 =C2=A0 =C2=A0}</div><div>}</div><div><br>With regards=
 to your solution 1 in the original OP of using a function and then calling=
 return. You say it is elegant but slow. Because of the time you need to ta=
ke to create a function? If that is such an issue why not just do an immedi=
ately invoked lambda expression which was one of Jason Turner&#39;s key poi=
nts at boostcon:<br></div><div><br></div><code><div style=3D"border:1px sol=
id rgb(187,187,187);background-color:rgb(250,250,250)"><div><span><span sty=
le=3D"color:rgb(0,0,0)"></span></span><span style=3D"font-family: courier n=
ew,monospace;"><span style=3D"color:rgb(0,0,0)">[&amp;](){</span> <br>=C2=
=A0 <span style=3D"color: rgb(0, 0, 255);">while</span> ( cond1 )<br>=C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 <span style=3D"color: rgb(0, 0, 255);">while</span> ( co=
nd2 )<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 {<br>=C2=
=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <s=
pan style=3D"color: rgb(0, 0, 255);">if</span> ( cond3 )<span style=3D"colo=
r:rgb(255,0,0)"><b><br></b><span style=3D"color:rgb(68,68,68)">=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {</span></span> <span style=
=3D"color:rgb(255,0,0)"><br></span></span><div style=3D"margin-left: 40px;"=
><div style=3D"margin-left: 80px;"><span style=3D"font-family: courier new,=
monospace;">=C2=A0 =C2=A0=C2=A0=C2=A0 <span style=3D"color: rgb(0, 0, 255);=
">return</span>;</span><br></div><span style=3D"font-family: courier new,mo=
nospace;"></span></div><span style=3D"font-family: courier new,monospace;">=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 }=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=
=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }<br>}();<br></span></div></div></code></div><=
/blockquote><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><=
div><code></code></div></div></blockquote><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><code></code><div><br>Really though, if y=
ou&#39;re going to have such complexity within your program, with it to be =
iterating through several loops, it would be better for you to separate it =
out into its own method or function function and give it a meaningful name.=
 I&#39;ve seen many talks from the likes of Herb Sutter, Sean Parent and Bj=
arne Stroustrup on the subject of reducing the complexity of your code and =
making it intuitive to read by dividing up the problem and giving each area=
 of the code its own name. For these reasons, while I do see why you want b=
reak(n), solution 1 is probably the most acceptable way to handle this issu=
e. Regardless of the extra time incurred in creating the new method/functio=
n. And <br></div></div><br>On Tuesday, September 13, 2016 at 1:00:03 AM UTC=
+2, Hyman Rosen wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;m=
argin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"l=
tr">And the labeled break is superior to both:<br><br><font face=3D"monospa=
ce, monospace"><span style=3D"font-size:10.4px;color:rgb(0,0,136);backgroun=
d-color:rgb(250,250,250)">outer: for</span><span style=3D"font-size:10.4px;=
color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0</span><span styl=
e=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250=
)">(</span><span style=3D"font-size:10.4px;color:rgb(0,0,136);background-co=
lor:rgb(250,250,250)">auto</span><span style=3D"font-size:10.4px;color:rgb(=
102,102,0);background-color:rgb(250,250,250)">&amp;&amp;</span><span style=
=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=
=C2=A0person=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,=
0);background-color:rgb(250,250,250)">:</span><span style=3D"font-size:10.4=
px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0people</span><=
span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(25=
0,250,250)">)=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102=
,0);background-color:rgb(250,250,250)">{</span><span style=3D"font-size:10.=
4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 i=
nner:=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(0,0,136);backgr=
ound-color:rgb(250,250,250)">for</span><span style=3D"font-size:10.4px;colo=
r:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0</span><span style=3D=
"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">(=
</span><span style=3D"font-size:10.4px;color:rgb(0,0,136);background-color:=
rgb(250,250,250)">auto</span><span style=3D"font-size:10.4px;color:rgb(102,=
102,0);background-color:rgb(250,250,250)">&amp;&amp;</span><span style=3D"f=
ont-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0p=
hone=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backg=
round-color:rgb(250,250,250)">:</span><span style=3D"font-size:10.4px;color=
:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0<wbr>person</span><spa=
n style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,2=
50,250)">.</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);backgroun=
d-color:rgb(250,250,250)">phones</span><span style=3D"font-size:10.4px;colo=
r:rgb(102,102,0);background-color:rgb(250,250,250)">)=C2=A0</span><span sty=
le=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,25=
0)">{</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-col=
or:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span styl=
e=3D"font-size:10.4px;color:rgb(0,0,136);background-color:rgb(250,250,250)"=
>if</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color=
:rgb(250,250,250)">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(1=
02,102,0);background-color:rgb(250,250,250)">(</span><span style=3D"font-si=
ze:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">isLandline</s=
pan><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:r=
gb(250,250,250)">(</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);b=
ackground-color:rgb(250,250,250)">phone</span><span style=3D"font-size:10.4=
px;color:rgb(102,102,0);background-color:rgb(250,250,250)">))</span><span s=
tyle=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)=
">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);backgro=
und-color:rgb(250,250,250)">{</span><span style=3D"font-size:10.4px;color:r=
gb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 std</span><span style=3D"font-size:10.4px;color:rgb(102,1=
02,0);background-color:rgb(250,250,250)">::</span><span style=3D"font-size:=
10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">cout=C2=A0</span=
><span style=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(=
250,250,250)">&lt;&lt;</span><span style=3D"font-size:10.4px;color:rgb(0,0,=
0);background-color:rgb(250,250,250)">=C2=A0person</span><span style=3D"fon=
t-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">.</sp=
an><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(25=
0,250,250)">name=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,=
102,0);background-color:rgb(250,250,250)">&lt;&lt;</span><span style=3D"fon=
t-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">=C2=A0</s=
pan><span style=3D"font-size:10.4px;color:rgb(0,136,0);background-color:rgb=
(250,250,250)">&quot; &quot;</span><span style=3D"font-size:10.4px;color:rg=
b(0,0,0);background-color:rgb(250,250,250)">=C2=A0</span><span style=3D"fon=
t-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;&=
lt;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color=
:rgb(250,250,250)">=C2=A0phone<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10=
..4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;&lt;</span=
><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,=
250,250)">=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(0,136,0);b=
ackground-color:rgb(250,250,250)">&quot; still uses landline, do not switch=
 it off!&quot;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);backg=
round-color:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10=
..4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;&lt;</span=
><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb(250,=
250,250)">=C2=A0std</span><span style=3D"font-size:10.4px;color:rgb(102,102=
,0);background-color:rgb(250,250,250)">::</span><span style=3D"font-size:10=
..4px;color:rgb(0,0,0);background-color:rgb(250,250,250)">endl</span><span s=
tyle=3D"font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,=
250)">;</span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-c=
olor:rgb(250,250,250)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0<=
/span><span style=3D"font-size:10.4px;color:rgb(0,0,0);background-color:rgb=
(250,250,250)">break outer</span><span style=3D"font-size:10.4px;color:rgb(=
102,102,0);background-color:rgb(250,250,250)">;</span><span style=3D"font-s=
ize:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(=
102,102,0);background-color:rgb(250,250,250)">}</span><span style=3D"font-s=
ize:10.4px;color:rgb(0,0,0);background-color:rgb(250,250,250)"><br>=C2=A0 =
=C2=A0=C2=A0</span><span style=3D"font-size:10.4px;color:rgb(102,102,0);bac=
kground-color:rgb(250,250,250)">}</span><span style=3D"font-size:10.4px;col=
or:rgb(0,0,0);background-color:rgb(250,250,250)"><br></span><span style=3D"=
font-size:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)">}<=
/span></font><div><font face=3D"monospace, monospace"><span style=3D"font-s=
ize:10.4px;color:rgb(102,102,0);background-color:rgb(250,250,250)"><br></sp=
an></font></div><div><span style=3D"font-size:12.8px">The label is seen bef=
ore the statement that uses it, and break and continue statements are alrea=
dy &quot;grokked&quot; by programmers of C-derived languages.=C2=A0 That me=
ans readers of the code don&#39;t have to worry about where a goto is going=
..=C2=A0 That&#39;s why they invented structured programming, after all.</sp=
an><br></div></div>
</blockquote></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/b81fcc0a-9a48-4afb-a9ef-798467c08925%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b81fcc0a-9a48-4afb-a9ef-798467c08925=
%40isocpp.org</a>.<br />

------=_Part_1319_462752108.1474018835513--

------=_Part_1318_1252223005.1474018835513--

.


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Fri, 16 Sep 2016 11:06:40 -0400
Raw View
On 2016-09-15 07:40, Carl Cook wrote:
> As a side note, what about a "block" statement? I'd find this useful. It's
> basically a more concise mechanism than do {} while (false);
>
> E.g.
>
> block
> {
>   DoSomethingUseful();
>   if (x == 0)
>     break;
>   DoSomethingElse();
>   if (y == 0)
>     break;
>   DoAnotherThing();
> }

    #define block for(int _block ## __LINE__ = 0; \
                      _block ## __LINE__ = 0; \
                      ++_block ## __LINE__)

....or use `do { ... } while(0)`.

--
Matthew

--
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/nrh1pu%24ndt%241%40blaine.gmane.org.

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Sat, 17 Sep 2016 18:42:33 +0300
Raw View
On 16 September 2016 at 18:06, Matthew Woehlke <mwoehlke.floss@gmail.com> wrote:
> On 2016-09-15 07:40, Carl Cook wrote:
>> As a side note, what about a "block" statement? I'd find this useful. It's
>> basically a more concise mechanism than do {} while (false);
>>
>> E.g.
>>
>> block
>> {
>>   DoSomethingUseful();
>>   if (x == 0)
>>     break;
>>   DoSomethingElse();
>>   if (y == 0)
>>     break;
>>   DoAnotherThing();
>> }
>
>     #define block for(int _block ## __LINE__ = 0; \
>                       _block ## __LINE__ = 0; \
>                       ++_block ## __LINE__)
>
> ...or use `do { ... } while(0)`.


We already have a mechanism for things like that, and it doesn't
require any macros.
You replace 'block' with '[&]', 'break' with 'return' and add a '();'
at the end.

[&]
{
    DoSomethingUseful();
    if (x==0)
        return;
    DoSomethingElse();
    if (y == 0)
        return;
    DoAnotherThing();
}();

--
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/CAFk2RUZ5POKQk2G5suYPB2qCUNzMXuQYFdT_g%3DD0NkOO_s-x%2BQ%40mail.gmail.com.

.


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Tue, 20 Sep 2016 10:54:12 -0400
Raw View
On 2016-09-17 11:42, Ville Voutilainen wrote:
> On 16 September 2016 at 18:06, Matthew Woehlke wrote:
>> On 2016-09-15 07:40, Carl Cook wrote:
>>> As a side note, what about a "block" statement? I'd find this useful. It's
>>> basically a more concise mechanism than do {} while (false);
>>>
>>> E.g.
>>>
>>> block
>>> {
>>>   DoSomethingUseful();
>>>   if (x == 0)
>>>     break;
>>>   DoSomethingElse();
>>>   if (y == 0)
>>>     break;
>>>   DoAnotherThing();
>>> }
>>
>>     #define block for(int _block ## __LINE__ = 0; \
>>                       _block ## __LINE__ = 0; \
>>                       ++_block ## __LINE__)
>>
>> ...or use `do { ... } while(0)`.
>
> We already have a mechanism for things like that, and it doesn't
> require any macros.
> You replace 'block' with '[&]', 'break' with 'return' and add a '();'
> at the end.

Okay, so there are (at least) *three* ways to achieve what Carl proposed
:-). (The macro happens to produce the exact syntax he showed, although
I'd personally prefer the do...while. I don't see how a lambda is an
improvement; if nothing else, you can't actually `return` from it.)

--
Matthew

--
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/nrriij%24l4j%241%40blaine.gmane.org.

.