DPDK patches and discussions
 help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: "Xie, Huawei" <huawei.xie@intel.com>,
	Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] fix checkpatch errors
Date: Thu, 28 Jan 2016 11:43:20 +0200	[thread overview]
Message-ID: <56A9E2B8.4050703@redhat.com> (raw)
In-Reply-To: <C37D651A908B024F974696C65296B57B4C5B5AB0@SHSMSX101.ccr.corp.intel.com>

On 01/28/2016 10:38 AM, Xie, Huawei wrote:
> On 1/28/2016 4:06 PM, Thomas Monjalon wrote:
>> 2016-01-28 03:09, Xie, Huawei:
>>> On 1/28/2016 2:17 AM, Thomas Monjalon wrote:
>>>> 2016-01-27 01:26, Huawei Xie:
>>>>> v2 changes:
>>>>>   add missed commit message in v1
>>>>>
>>>>> fix the error reported by checkpatch:
>>>>>   "ERROR: return is not a function, parentheses are not required"
>>>>>
>>>>> also removed other extra parentheses like:
>>>>>   "return val == 0"
>>>>>   "return (rte_mempool_lookup(...))"
>>>> How these examples are differents from above checkpatch error?
>>> Don't get it.
>> Me too ;)
>> I don't understand which paren you removed in "return val == 0"
>> and why you say "also removed other...", meaning it is different
>> from the checkpatch error.
>
> Got you. I thought your example means DPDK examples.
> I mean i also removed paren in "return (val == 0)". But checkpatch
> doesn't report "return (logical expression)" as error. I think it is
> also not necessary, so removed some of them. That is why i listed them
> seperately.
>

So perhaps there's a reason checkpatch doesn't report it as an error?
At least I find the parentheses to increase readability in case of 
logical expressions, for example

	return val == 0;

	return (val == 0);

The parentheses kinda force you to notice there's something special 
going on and its not val that's returned. This "note there's something 
special here" of course only works if parentheses are not sprinkled 
around everywhere.

	- Panu -

  reply	other threads:[~2016-01-28  9:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04  1:51 [dpdk-dev] [PATCH] " Huawei Xie
2016-01-05  2:21 ` Tan, Jianfeng
2016-01-05  2:27   ` Yuanhan Liu
2016-01-05  2:43   ` Xie, Huawei
2016-01-05 10:21   ` Mcnamara, John
2016-01-05 16:20     ` Xie, Huawei
2016-01-26 17:26 ` [dpdk-dev] [PATCH v2] " Huawei Xie
2016-01-27 18:16   ` Thomas Monjalon
2016-01-28  3:09     ` Xie, Huawei
2016-01-28  8:04       ` Thomas Monjalon
2016-01-28  8:38         ` Xie, Huawei
2016-01-28  9:43           ` Panu Matilainen [this message]
2016-01-27 13:58 ` [dpdk-dev] [PATCH v3] remove extra parentheses in return statement Huawei Xie
2016-02-10 14:50   ` Thomas Monjalon

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=56A9E2B8.4050703@redhat.com \
    --to=pmatilai@redhat.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=thomas.monjalon@6wind.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;
as well as URLs for NNTP newsgroup(s).