From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LoPnQ-0006hN-Bo for qemu-devel@nongnu.org; Mon, 30 Mar 2009 18:17:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LoPnK-0006eF-Fa for qemu-devel@nongnu.org; Mon, 30 Mar 2009 18:17:31 -0400 Received: from [199.232.76.173] (port=44458 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LoPnK-0006eB-Cp for qemu-devel@nongnu.org; Mon, 30 Mar 2009 18:17:26 -0400 Received: from bsdimp.com ([199.45.160.85]:54344 helo=harmony.bsdimp.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LoPnJ-0004dK-Uq for qemu-devel@nongnu.org; Mon, 30 Mar 2009 18:17:26 -0400 Date: Mon, 30 Mar 2009 16:15:14 -0600 (MDT) Message-Id: <20090330.161514.117919654.imp@bsdimp.com> Subject: Re: [Qemu-devel] [PATCH] Document Qemu coding style From: "M. Warner Losh" In-Reply-To: <20090330214321.GP3795@csclub.uwaterloo.ca> References: <49D12392.6040107@redhat.com> <20090330214321.GP3795@csclub.uwaterloo.ca> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, lsorense@csclub.uwaterloo.ca In message: <20090330214321.GP3795@csclub.uwaterloo.ca> lsorense@csclub.uwaterloo.ca (Lennart Sorensen) writes: : On Mon, Mar 30, 2009 at 10:54:58PM +0300, Avi Kivity wrote: : > Blue Swirl wrote: : >>> +4. Block structure : >>> + : >>> +Every indented statement is braced; even if the block contains just one : >>> +statement. : >>> : >> : >> I'd remove this, braces are not used consistently for one statement blocks. : >> : >> : > : > While that's true, I'd like to keep this. I found (after initially : > being annoyed by this; I dislike punctuation) that it's nice not to need : > to rebrace after adding or removing lines. : : I hate having to add braces to add a printf when debuging something. : If you forget the braces, you change the meaning of the code. To me : that's a disaster and enough reason that leaving out braces should : be banned. Code style that encourages creation of bugs is bad style. : Surprisingly many code styles don't get this however. With editors like emacs, this isn't an issue. : I also like consistency, and since you need braces for multiline : statements, why not always use them? Because it stretches the code vertically. More extra useless 'blank' lines makes it harder to get more code on the screen, which makes the code harder to understand. Anyway, this is a highly religious issue. Either you think that {} are the bee's knees and people are morons that don't use them, or you hate them with a huge passion and can't believe people are stupid enough to require it. There's a very small set of folks in between, and often little common ground: usually one camp tolerates the practices of the other... Warner