From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEKtd-0004T6-T7 for qemu-devel@nongnu.org; Mon, 25 Apr 2011 08:28:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEKtc-00012G-VE for qemu-devel@nongnu.org; Mon, 25 Apr 2011 08:28:09 -0400 Received: from bhuna.collabora.co.uk ([93.93.128.226]:40068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEKtc-000125-RG for qemu-devel@nongnu.org; Mon, 25 Apr 2011 08:28:08 -0400 From: Ian Molton In-Reply-To: <4DB16BBC.1@redhat.com> References: <1303138953-1334-1-git-send-email-mdroth@linux.vnet.ibm.com> <1303138953-1334-16-git-send-email-mdroth@linux.vnet.ibm.com> <4DAFEFEA.9020102@redhat.com> <4DB02F5D.7020204@linux.vnet.ibm.com> <1303464235.20064.1.camel@corwyn> <4DB16BBC.1@redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Mon, 25 Apr 2011 13:27:57 +0100 Message-ID: <1303734477.2676.2.camel@corwyn> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC][PATCH v2 15/17] guest agent: qemu-ga daemon Reply-To: ian.molton@collabora.co.uk List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: aliguori@linux.vnet.ibm.com, agl@linux.vnet.ibm.com, Michael Roth , qemu-devel@nongnu.org On Fri, 2011-04-22 at 13:51 +0200, Jes Sorensen wrote: > > What kind of coding error does splitting this out aim to prevent? > > missing break; / return; statements? Because I dont see how it > achieves > > that... > > Hiding things you miss when reading the code, it's a classic for > people > to do if(foo) bleh(); on the same line, and whoever reads the code > will > expect the action on the next line, especially if foo is a long > complex > statement. > > It's one of these 'just don't do it, it bites you in the end' things. Meh. I dont see it that way... Sure, if it was one line out of 20 written that way, it would be weird, but as is, its just part of a block of identical lines. I dont really see a parallel with the if() statement either since the condition in the switch() case isnt on the same line as such. I must admit that I only write one-liner if statements if the condition is short though. -Ian