From: Jean Sacren <sakiwit@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH] ipv4: remove parentheses in return statement
Date: Fri, 3 Aug 2012 14:23:50 -0600 [thread overview]
Message-ID: <20120803202350.GA7520@mail.gmail.com> (raw)
In-Reply-To: <20120803.015243.1041602621154758483.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Fri, 03 Aug 2012 01:52:43 -0700
>
> From: Jean Sacren <sakiwit@gmail.com>
> Date: Fri, 3 Aug 2012 01:43:10 -0600
>
> > Signed-off-by: Jean Sacren <sakiwit@gmail.com>
>
> > - return ((val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24)) &
> > - (IN4_ADDR_HSIZE - 1));
> > + return (val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24)) &
> > + (IN4_ADDR_HSIZE - 1);
>
> Those parenthesis are there to make the evaluation order and
> grouping explicit.
>
> The other ones you changed are wrong for similar reasons.
Barring the speed issue raised by Eric Dumazet, this patch is correct.
To illustrate, the patch merely changes
return (A);
to
return A;
where A is nothing but an expression, regardless if it is a simple one
or a compound one.
Whatever A is, it evaluates to a value. The parentheses do _not_
contribute to the evaluation. They do not alter precedence. They do not
make the evaluation order explicit. They are there to serve no purpose,
yet they do make return statement look like a function call.
Moreover, A is one single entity. It does not group with anything else.
I really don't see the significance of making A a group by itself.
Thank you for reviewing the patch. With all due respect, your assessment
is hard to agree with this moment.
--
Jean Sacren
next prev parent reply other threads:[~2012-08-03 20:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-03 7:43 [PATCH] ipv4: remove parentheses in return statement Jean Sacren
2012-08-03 8:52 ` David Miller
2012-08-03 20:23 ` Jean Sacren [this message]
2012-08-03 21:31 ` David Miller
2012-08-03 9:19 ` Eric Dumazet
2012-08-03 9:22 ` David Miller
2012-08-03 9:53 ` Eric Dumazet
2012-08-03 23:53 ` David Miller
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=20120803202350.GA7520@mail.gmail.com \
--to=sakiwit@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).