From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QDEuA-0006qu-CW for qemu-devel@nongnu.org; Fri, 22 Apr 2011 07:52:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QDEu9-00053A-Gb for qemu-devel@nongnu.org; Fri, 22 Apr 2011 07:52:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QDEu9-00052Y-5O for qemu-devel@nongnu.org; Fri, 22 Apr 2011 07:52:09 -0400 Message-ID: <4DB16BBC.1@redhat.com> Date: Fri, 22 Apr 2011 13:51:24 +0200 From: Jes Sorensen MIME-Version: 1.0 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> In-Reply-To: <1303464235.20064.1.camel@corwyn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC][PATCH v2 15/17] guest agent: qemu-ga daemon List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ian.molton@collabora.co.uk Cc: aliguori@linux.vnet.ibm.com, agl@linux.vnet.ibm.com, Michael Roth , qemu-devel@nongnu.org On 04/22/11 11:23, Ian Molton wrote: > On Thu, 2011-04-21 at 08:21 -0500, Michael Roth wrote: >>>> + switch (level& G_LOG_LEVEL_MASK) { >>>> + case G_LOG_LEVEL_ERROR: return "error"; >>>> + case G_LOG_LEVEL_CRITICAL: return "critical"; >>>> + case G_LOG_LEVEL_WARNING: return "warning"; >>>> + case G_LOG_LEVEL_MESSAGE: return "message"; >>>> + case G_LOG_LEVEL_INFO: return "info"; >>>> + case G_LOG_LEVEL_DEBUG: return "debug"; >>>> + default: return "user"; >>>> + } >>> >>> Urgh! >>> >>> No two statements on the same line please! > > Always wondered what the logic for this one is. IMHO the above is FAR > neater than splitting it to near double its height. > > 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. Jes