From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvXub-0008HU-3J for qemu-devel@nongnu.org; Wed, 07 Oct 2009 10:54:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvXuW-0008Be-1R for qemu-devel@nongnu.org; Wed, 07 Oct 2009 10:54:40 -0400 Received: from [199.232.76.173] (port=50882 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvXuV-0008BA-Op for qemu-devel@nongnu.org; Wed, 07 Oct 2009 10:54:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18611) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvXuV-0003F1-6g for qemu-devel@nongnu.org; Wed, 07 Oct 2009 10:54:35 -0400 Message-ID: <4ACCABA0.8080001@redhat.com> Date: Wed, 07 Oct 2009 16:54:24 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] CODING_STYLE: {} as in linux kernel References: <20091006190115.GA4768@redhat.com> <4ACCA1EA.4090509@redhat.com> In-Reply-To: <4ACCA1EA.4090509@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Blue Swirl , qemu-devel@nongnu.org, "Michael S. Tsirkin" >> - if (a == 5) { >> + if (a == 5) >> printf("a was 5.\n"); >> - } else if (a == 6) { >> + else if (a == 6) { >> printf("a was 6.\n"); >> - } else { >> + printf("multiply by 7 to get the answer.\n"); >> + } else >> printf("a was something else entirely.\n"); >> - } > > This is the best example of how having braces only sometimes makes > patches unreadable. All of the if/else lines are touched even though the > condition (and thus semantics) remains unchanged. I somehow dislike the unneeded branches because it looks a bit irritating to my eyes. They have advantages though. Making patches more readable is one, as kevin and the nice example above clearly points out ;) Another one is that you don't have to hop around in your editor adding and removing branches when throwing in a temporary debug printf. So I'd tend to keep them. cheers, Gerd