Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MggBJ-00035Q-P9 for qemu-devel@nongnu.org; Thu, 27 Aug 2009 10:42:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MggBE-000356-Bo for qemu-devel@nongnu.org; Thu, 27 Aug 2009 10:42:28 -0400 Received: from [199.232.76.173] (port=40312 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MggBE-000353-6P for qemu-devel@nongnu.org; Thu, 27 Aug 2009 10:42:24 -0400 Received: from mail.gmx.net ([213.165.64.20]:37437) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MggBD-00045w-HU for qemu-devel@nongnu.org; Thu, 27 Aug 2009 10:42:23 -0400 Date: Thu, 27 Aug 2009 16:42:14 +0200 From: Reimar =?iso-8859-1?Q?D=F6ffinger?= Subject: Re: [Qemu-devel] [PATCH] Remove typedef for bool from eepro100.c Message-ID: <20090827144214.GA3803@1und1.de> References: <1251376284-22426-1-git-send-email-amit.shah@redhat.com> <20090827124546.GA5912@1und1.de> <761ea48b0908270700i32fbaab9kb23d3cd2bfd09ebe@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <761ea48b0908270700i32fbaab9kb23d3cd2bfd09ebe@mail.gmail.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Thu, Aug 27, 2009 at 04:00:17PM +0200, Laurent Desnogues wrote: > On Thu, Aug 27, 2009 at 2:45 PM, Reimar > Döffinger wrote: > > 1) stdbool bool is probably 4 bytes, not just 1 like char > > It's one byte on my gcc 4.4.0. > > > I suggest to just get rid of bool in this file, it is only used in 5 > > places, i.e. change > >>        bool bit_el = ((command & 0x8000) != 0); > > to > >>        int bit_el = command & 0x8000; > > This is dangerous if you start using bit_el in integer expressions > by accident (for instance using & or |). Programming errors are dangerous in general. I don't see much of a point of cluttering the code with not really effective ways to hide their effects (unless you wanted to suggest using "bool bit_el = command & 0x8000;", I see that bool is already used in some places in qemu and performance doesn't matter here so it indeed shouldn't be a problem).