Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KQQ9s-0003Zb-EQ for mharc-grub-devel@gnu.org; Tue, 05 Aug 2008 13:17:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQQ9q-0003Yx-H3 for grub-devel@gnu.org; Tue, 05 Aug 2008 13:17:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQQ9n-0003Xn-PS for grub-devel@gnu.org; Tue, 05 Aug 2008 13:17:14 -0400 Received: from [199.232.76.173] (port=54106 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQQ9n-0003Xf-JG for grub-devel@gnu.org; Tue, 05 Aug 2008 13:17:11 -0400 Received: from gateway10.websitewelcome.com ([67.18.103.10]:55085) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KQQ9n-0001an-8O for grub-devel@gnu.org; Tue, 05 Aug 2008 13:17:11 -0400 Received: (qmail 22708 invoked from network); 5 Aug 2008 17:24:08 -0000 Received: from gator297.hostgator.com (74.53.228.114) by gateway10.websitewelcome.com with SMTP; 5 Aug 2008 17:24:08 -0000 Received: from spk.venturedesignservices.com ([65.61.115.34]:6897 helo=localhost) by gator297.hostgator.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1KQQ9k-00040P-7t for grub-devel@gnu.org; Tue, 05 Aug 2008 12:17:08 -0500 Date: Tue, 5 Aug 2008 10:15:53 -0700 From: Colin D Bennett To: grub-devel@gnu.org Message-ID: <20080805101553.43b8e727@gibibit.com> In-Reply-To: <1217891426.15145.38.camel@localhost> References: <1215137528.26019.58.camel@localhost> <87bq0sibu0.fsf@xs4all.nl> <1216601741.8334.122.camel@localhost> <877ib1khe9.fsf@xs4all.nl> <1217806150.9634.24.camel@localhost> <87iqug33m9.fsf@xs4all.nl> <1217891426.15145.38.camel@localhost> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator297.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - gibibit.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [PATCH] Drivemap module X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2008 17:17:14 -0000 On Tue, 05 Aug 2008 01:10:25 +0200 Javier Mart=C3=ADn wrote: > Besides, sometimes checks like "if (a=3Db)", or more > frequently "if (a=3Df())" are intentionally used in C, so the error > might become even more difficult to spot and correct. Respect and heed the gcc warnings!! Note that gcc will warn you (you *are* using -Wall, at least, right?) if you try to do if (a =3D b) but if you really mean it, you should surround the expression with an extra pair of parentheses: if ((a =3D b)) Use of the value of an assignment in an expression is common in code like if ((n =3D read (fd, buf, sz)) > 0) /* ... use the data in buf ... */ Here's an example showing gcc being helpful: $ cat a.c int f() { int a =3D 1; int b; if ((b =3D a)) return 1; return 0; } $ cat b.c int f() { int a =3D 1; int b; if (b =3D a) return 1; return 0; } $ gcc -Wall -c a.c $ gcc -Wall -c b.c b.c: In function =E2=80=98f=E2=80=99: b.c:5: warning: suggest parentheses around assignment used as truth $=20 > New version of the patch follows. I must say that the discussion here > has become pretty interesting without degrading into flamewarring - > who whats to call Mr. Torvalds and Prof. Tanembaum? ^^ Well, it sounds to me like you are trying your best to set Marco ablaze, but he is delightfully fire-retardant. Regards, Colin