220 12199 <CAGsORuCngd3hw6nOsaLGMdQ9AvCOd11Qh4jD62CjQBWu1jHJ+A@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Zhihao Yuan <zy@miator.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Fwd: Study on usage of break label / continue label
Date: Thu, 7 Aug 2014 19:24:07 -0400
Lines: 124
Approved: news@gmane.org
Message-ID: <CAGsORuCngd3hw6nOsaLGMdQ9AvCOd11Qh4jD62CjQBWu1jHJ+A@mail.gmail.com>
References: <CAB+4KHKZHy2iPRKKaFunX_QzzKC50zwu_ui8hX=ekaKQMxZEdQ@mail.gmail.com>	<CAB+4KHKBQgVpHrzvgGRWOTcTPTc1O6a4wmHa4jbDME1iJ-WSeQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a1133fe389a623d05001262ee"
X-Trace: ger.gmane.org 1407453859 15391 80.91.229.3 (7 Aug 2014 23:24:19 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 7 Aug 2014 23:24:19 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCSKRWMD4EHBBGMVSCPQKGQEL3KJJJA@isocpp.org Fri Aug 08 01:24:13 2014
Return-path: <std-proposals+bncBCSKRWMD4EHBBGMVSCPQKGQEL3KJJJA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qg0-f72.google.com ([209.85.192.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCSKRWMD4EHBBGMVSCPQKGQEL3KJJJA@isocpp.org>)
	id 1XFX2Y-0007L4-LG
	for gclcip-std-proposals@m.gmane.org; Fri, 08 Aug 2014 01:24:10 +0200
Original-Received: by mail-qg0-f72.google.com with SMTP id q107sf13219197qgd.11
        for <gclcip-std-proposals@m.gmane.org>; Thu, 07 Aug 2014 16:24:09 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:sender:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=h4bR+pFyg9vEepUMpe0TwJ530mfAB9AOHuzwZ9gzBt0=;
        b=T3zW3g+PHOM/M00oLdkN8KH48OZiQfMhqQQMtDJXAx/p2BlrX+uIwTCqQ2kdEI44Nx
         AxspkH/AZoECqPdWTWXrNIKRQHa4zwN2gZYhCQTuOYzj/jAebNOChNqGs5Jb8/sauLR0
         ggFMMkM6b4fDXzlAVFbrkwxHZw8/3BKMV/uWZayPhQXM275w0KaYAZ9bSkI+Q5tpApeN
         nUhEGDq2uqPf2030LUWGcTH6jHq/zCFcGLUjuUnM3AI+OyeIkP1UNbyWSwprLGQyGoPv
         rKbtULGq2uEdD03kYHh3wBmw0t6P3aoyu58/pdx6w8Y10KPlr+PnPyphDGSeQtt4QM+l
         wwEQ==
X-Gm-Message-State: ALoCoQnUZHGZPXogERINza3AI0x3TUFU1whKGuSwIgbjomWs7oODHIbTT5fCA80yMBmL3y0IjImI
X-Received: by 10.236.111.106 with SMTP id v70mr2888929yhg.21.1407453849869;
        Thu, 07 Aug 2014 16:24:09 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.93.34 with SMTP id c31ls341645qge.92.gmail; Thu, 07 Aug
 2014 16:24:09 -0700 (PDT)
X-Received: by 10.220.181.196 with SMTP id bz4mr18921866vcb.36.1407453849099;
        Thu, 07 Aug 2014 16:24:09 -0700 (PDT)
Original-Received: from mail-s68.mailgun.info (mail-s68.mailgun.info. [184.173.153.196])
        by mx.google.com with ESMTPS id vp2si2314794vcb.66.2014.08.07.16.24.08
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 07 Aug 2014 16:24:08 -0700 (PDT)
Received-SPF: pass (google.com: domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates 184.173.153.196 as permitted sender) client-ip=184.173.153.196;
Original-Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com
 [209.85.220.181]) by mxa.mailgun.org with ESMTP id 53e40a97.59bbc30-in1;
 Thu, 07 Aug 2014 23:24:07 -0000 (UTC)
Original-Received: by mail-vc0-f181.google.com with SMTP id lf12so7243314vcb.26 for
 <std-proposals@isocpp.org>; Thu, 07 Aug 2014 16:24:07 -0700 (PDT)
X-Received: by 10.53.12.225 with SMTP id et1mr4248336vdd.5.1407453847246;
 Thu, 07 Aug 2014 16:24:07 -0700 (PDT)
Original-Received: by 10.220.40.5 with HTTP; Thu, 7 Aug 2014 16:24:07 -0700 (PDT)
In-Reply-To: <CAB+4KHKBQgVpHrzvgGRWOTcTPTc1O6a4wmHa4jbDME1iJ-WSeQ@mail.gmail.com>
X-Mailgun-Sid: WyI3MTBkYiIsICJzdGQtcHJvcG9zYWxzQGlzb2NwcC5vcmciLCAiNjkxMTAiXQ==
Original-Sender: zy@miator.net
X-Original-Sender: zy@miator.net
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates
 184.173.153.196 as permitted sender) smtp.mail=bounce+3f9131.69110-std-proposals=isocpp.org@miator.net;
       dkim=pass header.i=@miator.net
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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:12199
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/12199>

--001a1133fe389a623d05001262ee
Content-Type: text/plain; charset=UTF-8

On Thu, Aug 7, 2014 at 6:00 PM, Andrew Tomazos <andrewtomazos@gmail.com>
wrote:

I've conducted a quick study of ~50,000,000 lines of production Java code
> extracted from the Ubuntu package repository for usages of break label /
> continue label.  Results attached.
>
>
No one read 80 pages of code.  Package them and upload to somewhere
is enough.

However, I'm *no one* -- I read all of 100 examples, and the below is my
analysis.

I observed six purposes of using labeled continue / break:

Type (count). explaination

A (35). inside `switch`, to disambiguate from `break`.
B (14). generated code, to disambiguate from `break`, but can use
    `goto` in C++ instead.
C (36). breaking out from an inner loop.
D (8).  useless, user just want to name a block.
E (2).  wrong sample, code is inside comment.
F (2).  cannot determine, but should be A or C.

Unfortunately I lost 3 samples.

If you think A and B are the same (not quite), then breaking out
from `switch` seems to be the major use case.

Here comes my question: do we just need a keyword/contextual
keyword to save `switch`?  Like

  case ...:
    break loop:
    ...
    continue loop:  // `loop` is a contextual keyword

-- 
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://bit.ly/blog4bsd

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a1133fe389a623d05001262ee
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thu, Aug 7, 2014 at 6:00 PM, Andrew Tomazos <span dir=
=3D"ltr">&lt;<a href=3D"mailto:andrewtomazos@gmail.com" target=3D"_blank">a=
ndrewtomazos@gmail.com</a>&gt;</span> wrote:<br><div class=3D"gmail_extra">=
<div class=3D"gmail_quote">
<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quo=
te"><div dir=3D"ltr">I&#39;ve conducted a quick study of ~50,000,000 lines =
of production Java code extracted from the Ubuntu package repository for us=
ages of break label / continue label. =C2=A0Results attached.<div>

<br></div></div></div></div></blockquote></div><br></div><div class=3D"gmai=
l_extra">No one read 80 pages of code.=C2=A0 Package them and upload to som=
ewhere<br></div><div class=3D"gmail_extra">is enough.<br><br></div><div cla=
ss=3D"gmail_extra">
However, I&#39;m *no one* -- I read all of 100 examples, and the below is m=
y<br>analysis.<br><br></div><div class=3D"gmail_extra">I observed six purpo=
ses of using labeled continue / break:<br><br></div><div class=3D"gmail_ext=
ra">
Type (count). explaination<br></div><div class=3D"gmail_extra"><br></div><d=
iv class=3D"gmail_extra">A (35). inside `switch`, to disambiguate from `bre=
ak`.<br></div><div class=3D"gmail_extra">B (14). generated code, to disambi=
guate from `break`, but can use<br>
</div><div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 `goto` in C++ instead.<=
br></div><div class=3D"gmail_extra">C (36). breaking out from an inner loop=
..<br></div><div class=3D"gmail_extra">D (8).=C2=A0 useless, user just want =
to name a block.<br></div>
<div class=3D"gmail_extra">E (2).=C2=A0 wrong sample, code is inside commen=
t.<br></div><div class=3D"gmail_extra">F (2).=C2=A0 cannot determine, but s=
hould be A or C.<br><br></div><div class=3D"gmail_extra">Unfortunately I lo=
st 3 samples.<br>
</div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">If yo=
u think A and B are the same (not quite), then breaking out<br></div><div c=
lass=3D"gmail_extra">from `switch` seems to be the major use case.<br></div=
><div class=3D"gmail_extra">
<br>Here comes my question: do we just need a keyword/contextual<br>keyword=
 to save `switch`?=C2=A0 Like<br><br></div><div class=3D"gmail_extra">=C2=
=A0 case ...:<br></div><div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 break =
loop:<br>=C2=A0=C2=A0=C2=A0 ...<br></div><div class=3D"gmail_extra">
=C2=A0=C2=A0=C2=A0 continue loop:=C2=A0 // `loop` is a contextual keyword<b=
r></div><div class=3D"gmail_extra"><br>-- <br>Zhihao Yuan, ID lichray<br>Th=
e best way to predict the future is to invent it.<br>______________________=
_____________________________<br>
4BSD -- <a href=3D"http://bit.ly/blog4bsd" target=3D"_blank">http://bit.ly/=
blog4bsd</a>
</div></div>

<p></p>

-- <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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a1133fe389a623d05001262ee--

.
