Received: from [140.186.70.92] (port=59990 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OffBe-000498-4f for qemu-devel@nongnu.org; Sun, 01 Aug 2010 16:31:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Off22-0006dk-IK for qemu-devel@nongnu.org; Sun, 01 Aug 2010 16:21:15 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:56705) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Off22-0006dW-7W for qemu-devel@nongnu.org; Sun, 01 Aug 2010 16:21:14 -0400 Message-ID: <4C55D716.9030805@mail.berlios.de> Date: Sun, 01 Aug 2010 22:20:38 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 0/3] Fix broken if statements References: <1279742717-10804-1-git-send-email-jschopp@austin.ibm.com> <4C486F66.7000303@mail.berlios.de> <0E21255B-6066-4F5A-B68C-3425E6F1102C@web.de> In-Reply-To: <0E21255B-6066-4F5A-B68C-3425E6F1102C@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Andreas_F=E4rber?= Cc: Joel Schopp , qemu-devel@nongnu.org Am 01.08.2010 19:25, schrieb Andreas Färber: > Am 22.07.2010 um 18:18 schrieb Stefan Weil: > >> Am 21.07.2010 22:05, schrieb Joel Schopp: >>> I have decided to apply the broken window theory of crime >>> http://en.wikipedia.org/wiki/Broken_windows_theory to code, and >>> more specifically to qemu[:] > >>> I'm hoping that fixing seemingly trivial >>> bugs will actually fix some more serious bugs, make the code run >>> just a bit smoother, or at the very least leave us with easier to >>> maintain code. > >>> Joel Schopp (3): >>> remove dead code from hw/loader.c >>> fix variable type in qemu-io.c >>> remove pointless if from vl.c > [...] >> How did you apply the broken window theory of crime to software code? >> Is this still a secret, or can you tell us more? > > If you consider Coding Style and Best Practice violations a crime > (vandalism / broken window), then e.g. removing dead code is to > prevent future code dead-on-arrival and - as criminal escalation - bugs. > > Applying it further might mean that someone could provide a patch > either adding or removing braces for all single line statements in the > code base so that the broken window argument (someone broke the rule > so I can, too) no longer holds for new patches arriving. :) > > Regards, > Andreas > Agreed. I should have been more precise in formulating my question: Is there some magic (= tool) which detected these "broken windows" in hw/loader.c, qemu-io.c and vl.c, or was it just a manual code review or luck? It's not too difficult to write a tool which detects most typical violations of coding style (Aurelien suggested such a filter for git), but Joel's "broken windows" are less obvious. Regards Stefan