From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEgzZ-0002gw-QK for qemu-devel@nongnu.org; Tue, 05 Aug 2014 11:49:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEgzT-0001qe-Km for qemu-devel@nongnu.org; Tue, 05 Aug 2014 11:49:37 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:49251 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEgzT-0001qV-EI for qemu-devel@nongnu.org; Tue, 05 Aug 2014 11:49:31 -0400 References: <1406879176-4008-1-git-send-email-arei.gonglei@huawei.com> <1406879176-4008-2-git-send-email-arei.gonglei@huawei.com> <53DBB9D8.50707@redhat.com> <33183CC9F5247A488A2544077AF1902086C23B6A@SZXEMA503-MBS.china.huawei.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= Date: Tue, 05 Aug 2014 16:48:18 +0100 In-reply-to: <33183CC9F5247A488A2544077AF1902086C23B6A@SZXEMA503-MBS.china.huawei.com> Message-ID: <87zjfjj5s8.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v3 1/8] CODING_STYLE: Section about conditional statement List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" Cc: "peter.maydell@linaro.org" , "peter.crosthwaite@xilinx.com" , "Huangweidong (C)" , "aliguori@amazon.com" , "mst@redhat.com" , "marcel.a@redhat.com" , Luonengjun , "qemu-devel@nongnu.org" , "armbru@redhat.com" , "av1474@comtv.ru" , "kraxel@redhat.com" , "stefanha@redhat.com" , "pbonzini@redhat.com" , "dmitry@daynix.com" , "imammedo@redhat.com" , "Huangpeng (Peter)" , "lcapitulino@redhat.com" , "afaerber@suse.de" , "dgilbert@redhat.com" Gonglei (Arei) writes: > Hi, > >> > Yoda conditions lack readability, and QEMU has a >> > strict compiler configuration for checking a common >> > mistake like "if (dev = NULL)". Make it a written rule. >> >> I know this is my suggested text, but now that I'm re-reading it, I'd >> recommend s/0/1/ in all three places, since comparison to 0 is one of >> those special cases where '!a' is faster to write than 'a == 0'. >> > Got it. Should we add explicit examples for: if (x) if (!x) then? -- Alex Bennée