From: Juan Quintela <quintela@mandrakesoft.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: "Martin J. Bligh" <mbligh@aracnet.com>,
Andrew Morton <akpm@digeo.com>,
colpatch@us.ibm.com, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] (2.5.66-mm2) War on warnings
Date: Tue, 01 Apr 2003 18:14:10 +0200 [thread overview]
Message-ID: <86u1diyz3h.fsf@trasno.mitica> (raw)
In-Reply-To: <20030401152703.GA21986@gtf.org> (Jeff Garzik's message of "Tue, 1 Apr 2003 10:27:03 -0500")
>>>>> "jeff" == Jeff Garzik <jgarzik@pobox.com> writes:
jeff> On Tue, Apr 01, 2003 at 07:22:37AM -0800, Martin J. Bligh wrote:
>> drivers/base/node.c: In function `register_node_type':
>> drivers/base/node.c:96: warning: suggest parentheses around assignment used as truth value
>> drivers/base/memblk.c: In function `register_memblk_type':
>> drivers/base/memblk.c:54: warning: suggest parentheses around assignment used as truth value
>>
>> Bah.
>>
>> --- linux-2.5.66-mm2/drivers/base/node.c 2003-04-01 06:40:02.000000000 -0800
>> +++ 2.5.66-mm2/drivers/base/node.c 2003-04-01 06:37:32.000000000 -0800
>> @@ -93,7 +93,7 @@ int __init register_node_type(void)
>> {
>> int error;
>> if (!(error = devclass_register(&node_devclass)))
>> - if (error = driver_register(&node_driver))
>> + if ((error = driver_register(&node_driver)))
>> devclass_unregister(&node_devclass);
jeff> Personally, I feel statements like these are prone to continual error
jeff> and confusion. I would prefer to break each test like this out into
jeff> separate assignment and test statements. Combining them decreases
jeff> readability, while saving a paltry few extra bytes of source code.
jeff> Sure, the gcc warning is silly, but the code is a bit obtuse too.
I think:
- gcc warning is good, normally you want to test, not assignation
- Linus style for that is:
if ((error = driver_register(&node_driver)) != 0)
which sounds more logical. the double parens things is just a bad
hack IMHO.
Later, Juan.
--
In theory, practice and theory are the same, but in practice they
are different -- Larry McVoy
prev parent reply other threads:[~2003-04-01 16:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-01 15:22 Martin J. Bligh
2003-04-01 15:27 ` Jeff Garzik
2003-04-01 16:13 ` Martin J. Bligh
2003-04-01 18:37 ` Matthew Dobson
2003-04-01 19:30 ` Matthew Dobson
2003-04-01 19:32 ` Matthew Dobson
2003-04-01 19:36 ` Martin J. Bligh
2003-04-01 16:14 ` Juan Quintela [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86u1diyz3h.fsf@trasno.mitica \
--to=quintela@mandrakesoft.com \
--cc=akpm@digeo.com \
--cc=colpatch@us.ibm.com \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®