220 33519 <34130636.8iyeqGTS6R@tjmaciei-mobl1> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: A more advanced switch
Date: Tue, 01 Aug 2017 14:34:23 -0700
Lines: 58
Approved: news@gmane.org
Message-ID: <34130636.8iyeqGTS6R@tjmaciei-mobl1>
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: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1501623270 8754 195.159.176.226 (1 Aug 2017 21:34:30 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 1 Aug 2017 21:34:30 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBY7HQPGAKGQE7HMDNEI@isocpp.org Tue Aug 01 23:34:26 2017
Return-path: <std-proposals+bncBCB4TK757YBRBY7HQPGAKGQE7HMDNEI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f198.google.com ([209.85.192.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCB4TK757YBRBY7HQPGAKGQE7HMDNEI@isocpp.org>)
	id 1dceo2-0001tj-Tj
	for gclcip-std-proposals@m.gmane.org; Tue, 01 Aug 2017 23:34:23 +0200
Original-Received: by mail-pf0-f198.google.com with SMTP id b83sf28411511pfl.6
        for <gclcip-std-proposals@m.gmane.org>; Tue, 01 Aug 2017 14:34:29 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1501623268; cv=pass;
        d=google.com; s=arc-20160816;
        b=nWsT8LxQMVGH+SPLSnhzwQv1Zm1tR/8oLV9CEif3VI4IyKKPACs0w/A6JErXsjX9IK
         VmFIQiNF4lVpVSe06/Xw7VIyyjjyQvZw2y4RA/85x7+CipAEnjrVAEELFbCI8q5QoLLn
         lKiJ7Zg9YfGH/rT6vvrDillO4B9ZWB6gkwXu6kiGrd9wZeaZ5KF/rqjUVHd+wHnQGwox
         XVMqKrM2+6mPnhJAgOZ9IZezEK92EfwaQ3+k/beTEDdUlIRaRqBsj7Kvu40jFxUHaZMt
         EtnTxX8BKLRh7Ibgn4W9nxdYmYHIeO0b3IALemTPJaFz0bxabnt5cBFssrIv2/h41YkC
         e0dQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-transfer-encoding
         :mime-version:references:in-reply-to:message-id:date:subject:to:from
         :arc-authentication-results:arc-message-signature:dkim-signature
         :arc-authentication-results;
        bh=W9HY0vwCGR66OgyKEig2xao5XeZannHzQiSXosqGw30=;
        b=n4wFmAO75ObC7b7pfqF7rHDQPRBHgvI+mN0ZCPLOqQUVtuvVuFY9/oe5danyQG0/1G
         X5ouRPdhRQ/+7magc2QDjI/WI0Gu+ptY/tpEF+8dQEPAmV2pgckqUYUiK33+O4dR+WL7
         /ItkFBe3VNmVIqh9CYwSHK6tlamScrFolXC4aGN76rQ3rCnkZgoHMryf9KW5Ve344XA2
         h+icon2rkePutY++roRVmrrt11O0QLCd62f7nu56oY+x0dnEkD3KVCDmQBpHXTKvWM2D
         XuRazdcPRGQLqyKaIwy8XvwPwJCy0kHVHn5A4ypgCDu/Zgr4T8bxdCN/ZdtW6/4q5jrj
         VqtQ==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=W9HY0vwCGR66OgyKEig2xao5XeZannHzQiSXosqGw30=;
        b=Lar3IIK0wv25HYhSs+4pciaNRMb34JBL4bNYPOHWTqJ/p/dIMyp+qeOgMFaKSjB6fL
         thTZfTVRt6SyTvdkirnI/2+gLo17SF7SMxdwv1Xw9L6geudaRjEmQM70yO8dDfBCg7w5
         gbDghymEqMDUc9cm+YC12pF7iww78E6RwPTaje/VLsh5kj0IxYDH+k/00y3x6BvGxrsC
         PClL85y6FULCc2NsoDEXqMf5Ujg7lAL1u8+BUMzA50CArpejkLfzwK19HlHzMed2RZA8
         iYrPvGHaS6ewmPh6BNeprZBnk57xP7idU+7LSCTwIUXMEeP1x/APBYE76oANPIwOb0y1
         kFDw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=W9HY0vwCGR66OgyKEig2xao5XeZannHzQiSXosqGw30=;
        b=pW0dHmDE0dPHuM7RTso3YWp3MM2U94O5AF+lL73koRqghr8LeovqOC7Dbf1zPOaK+j
         ioYxkWLx2h/KWmpCz/yse3gigpMusNhpNTYShk+ZVs/x6+8qYyXqHaMHmSXOVLrC5Q4q
         h6IAsXA7jl3NmNZWFoHselUTAimTe1oKgcKjBztABAOtoIELPmJarNxdt/cKznEO4aPI
         i/Xtf5vOSPNXKc4BUYdCAldXLkBLTtwQQqgrxq8v1Yr4B3bEtQWJMolK9RcwDS/RVEtg
         ycDA52TwcgWDl2Qcj5GEul90iWnrphth09m+HJCwu3sWB7sWdS+jq94RcazKuZOu1nwV
         g8a 
X-Gm-Message-State: AIVw113sB7Yc+rHfUvTeLDA5R3CXoZRAk6vNoG2NTWGWjtdvxGdN2dD9
	AbPf7O/5pijpOyAM
X-Received: by 10.99.51.200 with SMTP id z191mr15114979pgz.57.1501623268521;
        Tue, 01 Aug 2017 14:34:28 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.168.193 with SMTP id e62ls11784734ioj.6.gmail; Tue, 01 Aug
 2017 14:34:27 -0700 (PDT)
X-Received: by 10.107.136.213 with SMTP id s82mr22612217ioi.325.1501623267038;
        Tue, 01 Aug 2017 14:34:27 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1501623266; cv=none;
        d=google.com; s=arc-20160816;
        b=omh2ZPStT78cn6DMdUZD9DDQwhMn0Hest+SoGLcZXtxvZRZDdyohYnnjpSfQyG6CFX
         wZ2MxIbxDN/8pt95Nz8mEseL4F52nkeygNLQPuXlrK/Q9C583wml4gjWvHftsn/RyumK
         y0Md22jbU+9iVIxze3R7zGoRSzWcMpFYmnbWssBgGF7j0b6hQL+FCFey5xk7KpuSve1V
         QduvHdWE95Jruy2XP3t+pA9Xv353/px4oCGXYb1iFE8edwBDKq3SkLdiD9VM9N1mo9Fq
         9XqLImpfvGXmWfNybPie4mFs8VyRN2yo9ps5CzaMWMmzSwc9JHjf8H69A7qXpizM747K
         QPTw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:to:from:arc-authentication-results;
        bh=1CT3uCOz8EHsuK61Wwoqva0IcnpgeJZoe7vSIUMuTv4=;
        b=sweq2GqFjTKO9wWK73IVlAFOMKpgRWfeLIIi+Pj/u87/zqVfE0SVGr+NSXTQTRCza5
         etdNOMuHbo5iS6WEGlXx6OSNA1SOkjg56jJOa6+R/Lg3Bk8QUccJStXKcZzTA8owSQEd
         ASkYjAmzKLbeIYRvy21f/p8qHvTrRB5Kbe9U/Zc4WA8q3w0/7NuP2OF/bi5HQzvu+bKo
         dcDjY9tFF370v5PVykl8+4nh4+/3jPNX26fg1ddvgBbdY3htakBed8gK6PFZDhTmVvfV
         iyG1PKL3Xa1WQLsrEj3OVelDZZOuBuOWGmyDWw81gFDf8jF2niQDAnJ1qIpngBhaj8EC
         qBDA==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id v130si2783732itv.196.2017.08.01.14.34.26
        for <std-proposals@isocpp.org>;
        Tue, 01 Aug 2017 14:34:26 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl1.localnet (unknown [134.134.139.82])
	by gondolin.macieira.info (Postfix) with ESMTPSA id 6F49711B5B8
	for <std-proposals@isocpp.org>; Tue,  1 Aug 2017 14:34:25 -0700 (PDT)
In-Reply-To: <f8c908e2-d06f-4cd1-bda0-fe2b97fd21f1@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
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:33519
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33519>

On ter=C3=A7a-feira, 1 de agosto de 2017 14:24:04 PDT costelnistor12@gmail.=
com=20
wrote:
> 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.
>=20
> In Pawn we can do it a lot better:
> switch( variable )
> {
>     case 0 .. 4:

With GNU extensions to C and C++:

	case 0 ... 4:

> 1. There's no need for break, there's no fallthrough. Advantage: we can
> easily "continue" and "break" loops from inside the "switch".

That can't change now. This HAS been discussed in this list and in std-
discussions and, just like the non-local breaks, it's very hard to adapt th=
e=20
language grammar to.

We need a different keyword or some modification keyword to the switch, sin=
ce=20
there is unmarked code that expects to fall through. We cannot silently bre=
ak=20
them.

> I know that it's hard to have features accepted in such a popular standar=
d,
> 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).

We've done that in Qt. Not very difficult once the compiler starts warning.

The difficult part is to guess whether a fallthrough was intended or a brea=
k was=20
missing.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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/34130636.8iyeqGTS6R%40tjmaciei-mobl1.

.
