220 3603 <1365208009.32597.12.camel@patrick-laptop-debian.home> article
Path: news.gmane.org!not-for-mail
From: Patrick Michael Niedzielski <patrickniedzielski@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: "break break ;" etc. to break out of nested loops
Date: Sat, 06 Apr 2013 00:26:49 +0000
Lines: 31
Approved: news@gmane.org
Message-ID: <1365208009.32597.12.camel@patrick-laptop-debian.home>
References: <1f964e4b-2762-43b8-85e5-41392926b07a@isocpp.org>
	 <85c0ae97-3440-4a81-96c2-1af7ebb892ba@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1365278015 22952 80.91.229.3 (6 Apr 2013 19:53:35 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 6 Apr 2013 19:53:35 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC4IXLVISQMRBWOX7WFAKGQEMMDCUBA@isocpp.org Sat Apr 06 21:53:38 2013
Return-path: <std-proposals+bncBC4IXLVISQMRBWOX7WFAKGQEMMDCUBA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qc0-f198.google.com ([209.85.216.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC4IXLVISQMRBWOX7WFAKGQEMMDCUBA@isocpp.org>)
	id 1UOZBA-0008OH-VN
	for gclcip-std-proposals@m.gmane.org; Sat, 06 Apr 2013 21:53:37 +0200
Original-Received: by mail-qc0-f198.google.com with SMTP id v20sf6210867qcm.9
        for <gclcip-std-proposals@m.gmane.org>; Sat, 06 Apr 2013 12:53:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:received-spf:x-received
         :message-id:subject:from:to:date:in-reply-to:references:x-mailer
         :mime-version:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=VOPICCYbCndD0Op2sLkSGLUmpzXegkC4pTD4kgXwswE=;
        b=of1ljAY5vhrjVVCcWsvFDXu1IGiRJFqXSY8+M5Gden4MjbZk1sqlxT1FI1YKor8QCz
         QCvXnrf6qG0RcLbfYtYaE9kOo6AVvV8mJIeXd/l/bc9wnWaBk94iOAtyYB7yaU36ZOL5
         F2/nZcwzsrzm8eM6Er821nOLDmL2gxiqSssH6P3vlyEgJ+KZx7BJ30QqJ0OK9lhDZ+cE
         R2OQJhMZfMXxIz4P3WUmFAgOc+2NaG8G5v7blkoXAmbKxiaziraLoChSmhzFu71AuRtn
         6Jk/3LU8q+V5Fq/zsdSNeWMoVP1DdyWg630g3fWgy0/DKpBdICK 
X-Received: by 10.224.18.132 with SMTP id w4mr226456qaa.1.1365208025970;
        Fri, 05 Apr 2013 17:27:05 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.118.70 with SMTP id kk6ls43013qeb.9.gmail; Fri, 05 Apr 2013
 17:27:04 -0700 (PDT)
X-Received: by 10.52.178.161 with SMTP id cz1mr8241699vdc.7.1365208024432;
        Fri, 05 Apr 2013 17:27:04 -0700 (PDT)
Original-Received: from mail-vb0-x22c.google.com (mail-vb0-x22c.google.com [2607:f8b0:400c:c02::22c])
        by mx.google.com with ESMTPS id l8si12430787vdw.150.2013.04.05.17.27.04
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 05 Apr 2013 17:27:04 -0700 (PDT)
Received-SPF: pass (google.com: domain of patrickniedzielski@gmail.com designates 2607:f8b0:400c:c02::22c as permitted sender) client-ip=2607:f8b0:400c:c02::22c;
Original-Received: by mail-vb0-f44.google.com with SMTP id e12so2553144vbg.17
        for <std-proposals@isocpp.org>; Fri, 05 Apr 2013 17:27:04 -0700 (PDT)
X-Received: by 10.220.91.17 with SMTP id k17mr4444663vcm.36.1365208024287;
        Fri, 05 Apr 2013 17:27:04 -0700 (PDT)
Original-Received: from [192.168.1.8] (pool-108-49-23-65.bstnma.fios.verizon.net. [108.49.23.65])
        by mx.google.com with ESMTPS id qq6sm15853445vec.2.2013.04.05.17.27.02
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 05 Apr 2013 17:27:02 -0700 (PDT)
In-Reply-To: <85c0ae97-3440-4a81-96c2-1af7ebb892ba@isocpp.org>
X-Mailer: Evolution 3.4.4-3
X-Original-Sender: patrickniedzielski@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of patrickniedzielski@gmail.com designates 2607:f8b0:400c:c02::22c as
 permitted sender) smtp.mail=patrickniedzielski@gmail.com;       dkim=pass header.i=@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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:3603
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/3603>

On ven, 2013-04-05 at 12:53 -0700, Andrew Sandoval wrote:
> How about *return*?  That way you are pushed towards keeping your functions 
> simple.

[slightly off-topic, but keeping the same thread for now]

For large and complex loops, this is good advice.  For small and short
nested loops (looping a single statement over a two dimensional array),
breaking the code off into a separate function can (*can*, not *will*)
make the code harder to understand.  It should be determined on a
case-by-case basis whether breaking the code into a separate function is
actually productive or makes the flow and reasoning behind the code less
clear.

This is actually an okay place for a goto, if the loops are short and
clear, and breaking the two loops into a separate function doesn't make
sense.  Just be sure to document the reason for its use in the code.

Cheers,
Patrick Niedzielski

-- 

--- 
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/?hl=en.



.
