Re: [PATCH] ipv4: remove parentheses in return statement
From: Jean Sacren <hidden>
Date: 2012-08-03 20:26:46
From: David Miller <davem@davemloft.net> Date: Fri, 03 Aug 2012 01:52:43 -0700
From: Jean Sacren <redacted> Date: Fri, 3 Aug 2012 01:43:10 -0600quoted
Signed-off-by: Jean Sacren <redacted>quoted
- 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