From owner-cvs-src@FreeBSD.ORG Sun Jun 22 18:29:22 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7582F37B401; Sun, 22 Jun 2003 18:29:22 -0700 (PDT) Received: from smtp4.server.rpi.edu (smtp4.server.rpi.edu [128.113.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C9B443FD7; Sun, 22 Jun 2003 18:29:21 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp4.server.rpi.edu (8.12.9/8.12.9) with ESMTP id h5N1TGPx014187; Sun, 22 Jun 2003 21:29:16 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <1197.1056217385@critter.freebsd.dk> References: <1197.1056217385@critter.freebsd.dk> Date: Sun, 22 Jun 2003 21:29:15 -0400 To: "Poul-Henning Kamp" , "Sam Leffler" From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.28 cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/vm vm_mmap.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2003 01:29:22 -0000 At 7:43 PM +0200 6/21/03, Poul-Henning Kamp wrote: > >> Log: > >> Use a do {...} while (0); and a couple of breaks to reduce > >> the level of indentation a bit. >>> >>> Revision Changes Path >>> 1.161 +80 -78 src/sys/vm/vm_mmap.c > >> http://cvsweb.FreeBSD.org/src/sys/vm/vm_mmap.c.diff?r1=1.160&r2=1.161 >> >>I find this change truly repulsive and gratuitous. > >It is a precusor to moving devices out of vnodes. In order to >get the patch which _does_ something to be manageable, I will >sort out some minor issues first, this is one of them. > >If your complaint is about the use of do { ... break; ... break; } >while (0); then launch an campaign to have it banned in style 9. > >IMO it is superior to goto, and ever deepening if-else constructs. For this specific example, I don't see that it really buys you all that much. However, I would say that there are times that the 'do { ... break; ... break; } while (0);' strategy can be much easier to read than ever-deepening if-else's. I would not be happy to see it banned in style(9). When I use it, I do tend to put a comment on the either the first or the file line, eg: do { /* just a target for 'break's */ } while (0); /* just a target for 'break's */ This is just my own opinion, of course. I'm not going to get all wild-eyed and pound the table over it. The other tactic I use is: if (...) { if (other) goto skipstuff; if (yetmore) goto skipstuff; ...stuff... skipstuff: alwaydo() } which works about the same when it comes to indent-levels. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu