[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54081A77.6000209@chirality.org.uk>
Date: Thu, 04 Sep 2014 08:53:27 +0100
From: Ian Morris <ipm@...rality.org.uk>
To: Yuval Mintz <Yuval.Mintz@...gic.com>,
YOSHIFUJI Hideaki/吉藤英明
<hideaki.yoshifuji@...aclelinux.com>,
netdev <netdev@...r.kernel.org>
CC: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
Subject: Re: [PATCH net-next 4/4] ipv6: coding style - cleanse bracing
On 03/09/14 08:52, Yuval Mintz wrote:
>> Hi,
>>
>> Ian Morris wrote:
>>> Tidy up braces in a few places (mainly if statements):
>>> * remove unnecessary braces
>>> * add braces for single line statements where part of an "else" where
>>> the other branch has braces
>> Hmm, I am not for this change.
>>
>> If "if" (or "else") statement occupies multiple lines, I want to see braces even if it
>> contains a single statement.
>> On the other hand, especiallly if the statement occupiles only one line (and the
>> logic do not require those braces), no braces.
>>
>> e.g. 1
>> if (cond)
>> statement();
>> else {
>> statement2(argument,
>> argument2);
>> }
> I was under the impression the coding style require matching curly braces on all
> if and else clauses, e.g., in the previous example I would have expected the `if' to
> have curly braces since its else block has them, regardless of whether its
> statement-block has more than a single line.
Indeed, this was my understanding which is why the patch is mostly the
way it is. I suppose if netdev can have its own approach for comments,
there's no reason not to have a netdev approach for if...else patterns
also but presently things are a little inconsistent in the ipv6 code
unfortunately so some work will be required either way.
>> e.g. 2
>> if (cond) {
>> if (cond2)
>> statement();
>> } else
>> statement2(argument, argument2);
>>
>> e.g. 3
>> if (cond) {
>> /* comment */
>> statement();
>> }
> ________________________________
>
> This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists