From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEh3q-0004Uw-Ev for qemu-devel@nongnu.org; Tue, 05 Aug 2014 11:54:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEh3l-0003Hf-L3 for qemu-devel@nongnu.org; Tue, 05 Aug 2014 11:54:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEh3l-0003HW-Bz for qemu-devel@nongnu.org; Tue, 05 Aug 2014 11:53:57 -0400 Date: Tue, 5 Aug 2014 17:53:35 +0200 From: "Michael S. Tsirkin" Message-ID: <20140805155335.GB17278@redhat.com> 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> <87zjfjj5s8.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <87zjfjj5s8.fsf@linaro.org> Content-Transfer-Encoding: quoted-printable 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: Alex =?iso-8859-1?Q?Benn=E9e?= Cc: "peter.maydell@linaro.org" , "peter.crosthwaite@xilinx.com" , "Huangweidong (C)" , "aliguori@amazon.com" , "marcel.a@redhat.com" , Luonengjun , "qemu-devel@nongnu.org" , "armbru@redhat.com" , "Gonglei (Arei)" , "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" On Tue, Aug 05, 2014 at 04:48:18PM +0100, Alex Benn=E9e wrote: >=20 > Gonglei (Arei) writes: >=20 > > Hi, > > > >> > Yoda conditions lack readability, and QEMU has a > >> > strict compiler configuration for checking a common > >> > mistake like "if (dev =3D NULL)". Make it a written rule. > > >>=20 > >> 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 o= f > >> those special cases where '!a' is faster to write than 'a =3D=3D 0'. > >>=20 > > Got it. >=20 > Should we add explicit examples for: >=20 > if (x) > if (!x) >=20 > then? Some people prefer a !=3D NULL and not !a. It's easy to change all =3D=3D NULL and !=3D NULL if people prefer this: http://www.emn.fr/z-info/coccinelle/rules/badzero.html > --=20 > Alex Benn=E9e