220 33718 <574320af-c1ae-4676-883c-ae4e91fcd874@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: gmisocpp@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: A more advanced switch
Date: Wed, 9 Aug 2017 06:08:05 -0700 (PDT)
Lines: 294
Approved: news@gmane.org
Message-ID: <574320af-c1ae-4676-883c-ae4e91fcd874@isocpp.org>
References: <f8c908e2-d06f-4cd1-bda0-fe2b97fd21f1@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_5174_1310644540.1502284085716"
X-Trace: blaine.gmane.org 1502284087 8962 195.159.176.226 (9 Aug 2017 13:08:07 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 9 Aug 2017 13:08:07 +0000 (UTC)
Cc: costelnistor12@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCM3TRNUXUDBBNUSVTGAKGQELSALQEY@isocpp.org Wed Aug 09 15:08:03 2017
Return-path: <std-proposals+bncBCM3TRNUXUDBBNUSVTGAKGQELSALQEY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f71.google.com ([209.85.214.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCM3TRNUXUDBBNUSVTGAKGQELSALQEY@isocpp.org>)
	id 1dfQiP-00022K-Mn
	for gclcip-std-proposals@m.gmane.org; Wed, 09 Aug 2017 15:08:02 +0200
Original-Received: by mail-it0-f71.google.com with SMTP id o19sf52634349ito.5
        for <gclcip-std-proposals@m.gmane.org>; Wed, 09 Aug 2017 06:08:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=bR8u9NOQoV+mq65EEVeSFrKVLGxDjXD4pi0GerPsTZ4=;
        b=PrXI8kIULEF52MryqhwooIiXb8HXCWCrJaM8Fkj0it1gIW2XjOe0Gj5/6Ol5JXUJ8g
         Zph0dOpFu6T9aSOcVG+Fz6iQK27tY0xTPf9y68ACWdY4jgw6u4mjHsLSsydJa/vS94Zv
         X++qEcjK8nsmuoEz3IR86cZjbVVAZ0U1TxFSfcwHpnk+OIwmsl4GGbDoE6cMjGmTo4Ao
         sGHVN2IgP2tZ22n1ik0EN9KTK31KYnGaNonIuiUGaRGeLDHL8wlOFicluLtbVJLvOaY4
         xyhxv9qmGHKDKWdakTuloBeMRvxsDxmFf+aE5WZpwS4UB8zo7SieXQ6JSjBmR7nwWWMI
         XWUQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=bR8u9NOQoV+mq65EEVeSFrKVLGxDjXD4pi0GerPsTZ4=;
        b=gbnVPo3i5VfUhu6wD4q0bpVDuAgLT9wu/BHsr6fzXSPNpFC1A823uG/c6/n7ODpIyk
         pYf1LXgXJ11Lb+1q46cCGQMCP6aBDGcxff27/qaZ5R90p92pINrc2wLhLuOvwxpHyACZ
         sfT0AOqRPFhijr3iAo66dSw4DXbyPzCKGhVhdhX1bE56q8JKnLMOgeirzO54w1kONxxs
         Np5/1tbTmsBMFZ43DI8HmA1xo3gQQs3YpJQPJrEwLV/4ZhCDVwTUPxCfG5GDLykw6ug9
         506Z+Yc0lDZ7gQcDzlQ1MAQjxg4j9wUuT70hr7/pcYicTU5AhTONYcYz+speragDNtdl
         yrtg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=bR8u9NOQoV+mq65EEVeSFrKVLGxDjXD4pi0GerPsTZ4=;
        b=CvRkNsto+X2yu4IEirVr6QneovRk6oey9a2yxHMO+tOvUg757+jK5KeuB8w9YmBcTL
         pxK64AHdyCDpWmAub7fI9wwhTLcpn6GmWHdI2SEKBa0+X3Yz5pcpx1uII3h7LZA51wtQ
         9MnL48Ne54eOrxBMx6U7JbXUe9F0/VK5ZvdGa8BLQBqkr7+BkOACkQyT7epftWP3GtGU
         z5arYdtSE53KuvOaL5G5m0syrvNGDvdSlbHZ0gRnLmIMC/vtn5nBNhNnhdRQttTADW2q
         kcWERbkjCmRfYfTj0yNIWmPqgsTCWDpOCik03M9t+hNg+dQWXZyHKIvRmP7nrNCQZ7Dl
         8W6Q==
X-Gm-Message-State: AIVw110jnEoXfFuV2/KxWOgBN2tqj5RlQK7Tozcypio79m8hujdmps4M
	4UzDiw556+RYTLdT
X-Received: by 10.36.41.7 with SMTP id p7mr5049739itp.25.1502284087731;
        Wed, 09 Aug 2017 06:08:07 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.173.71 with SMTP id w68ls4716011ioe.23.gmail; Wed, 09 Aug
 2017 06:08:06 -0700 (PDT)
X-Received: by 10.31.153.84 with SMTP id b81mr41624vke.14.1502284086377;
        Wed, 09 Aug 2017 06:08:06 -0700 (PDT)
In-Reply-To: <f8c908e2-d06f-4cd1-bda0-fe2b97fd21f1@isocpp.org>
X-Original-Sender: gmisocpp@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:33718
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33718>

------=_Part_5174_1310644540.1502284085716
Content-Type: multipart/alternative; 
	boundary="----=_Part_5175_654013518.1502284085717"

------=_Part_5175_654013518.1502284085717
Content-Type: text/plain; charset="UTF-8"


I would very much like to see some changes to switch.

I'd like something like:

switch break (x) // cases break by default;
{
    case 1: whatever();
    case 2: whatever();
}

I'd also like, for at least this variation of switch, for a case to be a 
scope by default, such that is ok:
So that variables can be declared without requiring more braces.

switch break (x) // cases break by default;
{
    case 1: int z = 1; whatever(z); // not an error
    case 2: whatever();
}

I think this would make most switch statements a lot less verbose.
It seems a lot of the flexibility of the classic switch just isn't required.
So this switch could be used when it's not and the existing switch can be 
used when it is.

switch break seems easy to teach to me. So why not?


On Wednesday, August 2, 2017 at 9:24:04 AM UTC+12, costeln...@gmail.com 
wrote:

> Hello, I'm sorry if you talked about this here before, but I didn't watch 
> this group and I couldn't find this thing when searching.
>
> I'm coming from another language named Pawn, it looks like C ~80%, but it 
> has more advantages than C. Here's the official page: 
> https://www.compuphase.com/pawn/pawn.htm .
>
> A problem in C++: "switch" is exactly like in C, I think it deserves an 
> upgrade, as it can be used a lot, providing more speed and easier syntax 
> than lots of "if" ... "else if" ... "else" lines. I know that simply 
> updating it would break compatibility, so it may require another name 
> instead of switch, or you can find any other backwards compatible 
> alternative. I bet you can do this perfectly.
>
> For cases 0, 1, 2, 3, 4 and 5, 6 and "default" in C++ we have to do it like
> switch( variable )
> {
>     case 0: case 1: case 2: case 3: case 4:
>     {
>         // ...
>         break;
>     }
>
>     case 5: case 6:
>     {
>         // ...
>         break;
>     }
>
>     default:
>     {
>         // ...
>     }
> }
>
> We have to use "case" for every, well, case when specifying a sequence, 
> because it uses fallthrough. We have to use "break" to avoid that. I find 
> this bad. Because of the necessity of using "break" we can't just "break" 
> out of a loop if the switch is inside a loop. Also, if there are 
> consecutive cases we have to specify each one of them. Additionally, we 
> could also forget breaking. This "switch" isn't safe and is pretty old.
>
> In Pawn we can do it a lot better:
> switch( variable )
> {
>     case 0 .. 4:
>     {
>         // ...
>     }
>
>     case 5, 6:
>     {
>         // ...
>     }
>
>     default:
>     {
>         // ...
>     }
> }
>
> 1. There's no need for break, there's no fallthrough. Advantage: we can 
> easily "continue" and "break" loops from inside the "switch".
> 2. We can use ".." if using several cases that are consecutive in the same 
> block of code, to specify an interval.
>
> I know that it's hard to have features accepted in such a popular 
> standard, but upgrading switch is something that should really be 
> considered ! C++17's [[fallthrough]] attribute is just as complicated as 
> the "switch". It needs to be added everywhere or else we would get warnings 
> (AFAIK).
>
> C++ needs a lot more syntactic sugar. Small and nice things are making the 
> language more likeable. I think that you should watch other languages too 
> for interesting small features.
>

-- 
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/574320af-c1ae-4676-883c-ae4e91fcd874%40isocpp.org.

------=_Part_5175_654013518.1502284085717
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><br></div><div>I would very much like to see some cha=
nges to switch.</div><div><br></div><div>I&#39;d like something like:</div>=
<div><br></div><div>switch break (x) // cases break by default;</div><div>{=
</div><div>=C2=A0=C2=A0=C2=A0 case 1: whatever();</div><div>=C2=A0=C2=A0=C2=
=A0=C2=A0case 2: whatever();<br>}</div><div><br></div><div>I&#39;d also lik=
e, for at least this variation of switch,=C2=A0for=C2=A0a case=C2=A0to be a=
 scope by default, such that is ok:</div><div>So that variables can be decl=
ared without requiring more braces.</div><div><br></div><div><div>switch br=
eak (x) // cases break by default;</div><div>{</div><div>=C2=A0=C2=A0=C2=A0=
 case 1: int z =3D 1; whatever(z); // not an error</div><div>=C2=A0=C2=A0=
=C2=A0=C2=A0case 2: whatever();<br>}</div><div><br></div><div>I think this =
would make most switch statements a lot less verbose.</div><div>It seems a =
lot of the flexibility of the classic switch just isn&#39;t required.</div>=
<div>So this switch could be used when it&#39;s not and the existing switch=
 can be used when it is.</div><div><br></div><div>switch break seems easy t=
o teach to me. So why not?<br><br><br>On Wednesday, August 2, 2017 at 9:24:=
04 AM UTC+12, costeln...@gmail.com wrote:</div></div><blockquote class=3D"g=
mail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-l=
eft-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: s=
olid;"><div dir=3D"ltr">Hello, I&#39;m sorry if you talked about this here =
before, but I didn&#39;t watch this group and I couldn&#39;t find this thin=
g when searching.<div><br></div><div>I&#39;m coming from another language n=
amed Pawn, it looks like C ~80%, but it has more advantages than C. Here&#3=
9;s the official page:=C2=A0<a onmousedown=3D"this.href=3D&#39;https://www.=
google.com/url?q\x3dhttps%3A%2F%2Fwww.compuphase.com%2Fpawn%2Fpawn.htm\x26s=
a\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF6HwzHRS3ePvT8Rb_fa7FAjq_ktA&#39;;retur=
n true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%=
3A%2F%2Fwww.compuphase.com%2Fpawn%2Fpawn.htm\x26sa\x3dD\x26sntz\x3d1\x26usg=
\x3dAFQjCNF6HwzHRS3ePvT8Rb_fa7FAjq_ktA&#39;;return true;" href=3D"https://w=
ww.compuphase.com/pawn/pawn.htm" target=3D"_blank" rel=3D"nofollow">https:/=
/www.compuphase.<wbr>com/pawn/pawn.htm</a> .</div><div><br></div><div>A pro=
blem in C++: &quot;switch&quot; is exactly like in C, I think it deserves a=
n upgrade, as it can be used a lot, providing more speed and easier syntax =
than lots of &quot;if&quot; ... &quot;else if&quot; ... &quot;else&quot; li=
nes. I know that simply updating it would break compatibility, so it may re=
quire another name instead of switch, or you can find any other backwards c=
ompatible alternative. I bet you can do this perfectly.<div><br></div><div>=
For cases 0, 1, 2, 3, 4 and 5, 6 and &quot;default&quot; in C++ we have to =
do it like</div><div style=3D"border: 1px solid rgb(187, 187, 187); border-=
image: none; -ms-word-wrap: break-word; background-color: rgb(250, 250, 250=
);"><code><div><span style=3D"color: rgb(0, 0, 136);">switch</span><span st=
yle=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0)=
;"> variable </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, 10=
2, 0);">{</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color: rgb(0, 0, 136);">case</span><span style=3D"color: =
rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">0</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);">case</span><span sty=
le=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);=
">1</span><span style=3D"color: rgb(102, 102, 0);">:</span><span style=3D"c=
olor: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);">case</s=
pan><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(=
0, 102, 102);">2</span><span style=3D"color: rgb(102, 102, 0);">:</span><sp=
an style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 1=
36);">case</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 102, 102);">3</span><span style=3D"color: rgb(102, 102, 0=
);">:</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"col=
or: rgb(0, 0, 136);">case</span><span style=3D"color: rgb(0, 0, 0);"> </spa=
n><span style=3D"color: rgb(0, 102, 102);">4</span><span style=3D"color: rg=
b(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 styl=
e=3D"color: rgb(136, 0, 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);">break</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(102, 102, 0);">}</span><span style=3D"color: rgb(0, 0, 0);"><br><br>=
=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(0, 102, =
102);">5</span><span 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);">ca=
se</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color:=
 rgb(0, 102, 102);">6</span><span style=3D"color: rgb(102, 102, 0);">:</spa=
n><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(136, 0, 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);">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, 102, 0);">}</s=
pan><span style=3D"color: rgb(0, 0, 0);"><br><br>=C2=A0 =C2=A0 </span><span=
 style=3D"color: rgb(0, 0, 136);">default</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(136, 0, 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></span><span style=3D"color: rgb(10=
2, 102, 0);">}</span></div></code></div><div><br></div><div>We have to use =
&quot;case&quot; for every, well, case when specifying a sequence, because =
it uses fallthrough. We have to use &quot;break&quot; to avoid that. I find=
 this bad. Because of the necessity of using &quot;break&quot; we can&#39;t=
 just &quot;break&quot; out of a loop if the switch is inside a loop. Also,=
 if there are consecutive cases we have to specify each one of them. Additi=
onally, we could also forget breaking. This &quot;switch&quot; isn&#39;t sa=
fe and is pretty old.</div><div><br></div><div>In Pawn we can do it a lot b=
etter:</div><div><div style=3D"border: 1px solid rgb(187, 187, 187); border=
-image: none; -ms-word-wrap: break-word; background-color: rgb(250, 250, 25=
0);"><code><div><span style=3D"color: rgb(0, 0, 136);">switch</span><span s=
tyle=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0=
);"> variable </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, 1=
02, 0);">{</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color: rgb(0, 0, 136);">case</span><span style=3D"color:=
 rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">0</span><f=
ont color=3D"#666600"><span style=3D"color: rgb(0, 0, 0);"> </span><span st=
yle=3D"color: rgb(102, 102, 0);">..</span><span style=3D"color: rgb(0, 0, 0=
);"> </span></font><span style=3D"color: rgb(0, 102, 102);">4</span><span s=
tyle=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);">{</sp=
an><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </s=
pan><span style=3D"color: rgb(136, 0, 0);">// ...</span><span style=3D"colo=
r: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 </span><span style=3D"color: rgb(102, 1=
02, 0);">}</span><span style=3D"color: rgb(0, 0, 0);"><br><br>=C2=A0 =C2=A0=
 </span><span style=3D"color: rgb(0, 0, 136);">case</span><span style=3D"co=
lor: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">5</spa=
n><font color=3D"#666600"><span style=3D"color: rgb(102, 102, 0);">,</span>=
<span style=3D"color: rgb(0, 0, 0);"> </span></font><span style=3D"color: r=
gb(0, 102, 102);">6</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(136, 0, 0)=
;">// ...</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color: rgb(102, 102, 0);">}</span><span style=3D"color: r=
gb(0, 0, 0);"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color: rgb(0, 0, =
136);">default</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"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(136, 0, 0);">// .=
...</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 </span><spa=
n 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></div></=
code></div><span style=3D"color: rgb(102, 102, 0); font-family: monospace; =
background-color: rgb(250, 250, 250);"><br></span>1. There&#39;s no need fo=
r break, there&#39;s no fallthrough. Advantage: we can easily &quot;continu=
e&quot; and &quot;break&quot; loops from inside the &quot;switch&quot;.</di=
v><div>2. We can use &quot;..&quot; if using several cases that are consecu=
tive in the same block of code, to specify an interval.</div><div><br></div=
><div>I know that it&#39;s hard to have features accepted in such a popular=
 standard, but upgrading switch is something that should really be consider=
ed ! C++17&#39;s [[fallthrough]] attribute is just as complicated as the &q=
uot;switch&quot;. It needs to be added everywhere or else we would get warn=
ings (AFAIK).</div><div><br></div><div>C++ needs a lot more syntactic sugar=
.. Small and nice things are making the language more likeable. I think that=
 you should watch other languages too for interesting small features.</div>=
</div></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/574320af-c1ae-4676-883c-ae4e91fcd874%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/574320af-c1ae-4676-883c-ae4e91fcd874=
%40isocpp.org</a>.<br />

------=_Part_5175_654013518.1502284085717--

------=_Part_5174_1310644540.1502284085716--

.
