public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: Chang Yu <marcus.yu.56@gmail.com>,
	David Laight <David.Laight@aculab.com>
Cc: "Larry.Finger@lwfinger.net" <Larry.Finger@lwfinger.net>,
	"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: r8188eu: combine nested if statements into one
Date: Fri, 24 Jun 2022 07:26:20 +0200	[thread overview]
Message-ID: <ac6d83d6-c8b0-e0bd-10aa-a49897679edb@gmail.com> (raw)
In-Reply-To: <YrUv1sPuny1M1Orh@zephyrus-g14.localdomain>

On 6/24/22 05:30, Chang Yu wrote:
> On Thu, Jun 23, 2022 at 12:05:40PM +0000, David Laight wrote:
>> ...
>>> Seems to work. But the rules which operation is done first && or == are
>>> not too easy.
>>
>> They are the way around you want them to be.
>> == generates a truth value.
>> && and || compare truth values,
>>
>> The only 'wrong' operator priorities are & and |.
>> The short-circuiting && and || weren't in the very early
>> versions of C - the bitwise & and | were used.
>> When K&R added && and || they left the priorities of & an | alone.
>> I they they've later said they should have bitten the bullet
>> and changed the priorities and all the existing C code
>>
>>> I would prefer to have:
>>>
>>> if (padapter && (pfree_recv_queue == free_recv_queue))
>>>
>>> So it is very easy to read what is evaluated first.
>>
>> That just starts adding too many () and makes more complex
>> conditionals hard to read.
>>
>> 	David
>>
>>>
>>> But this is just my opinion and does not have to be right.
>>>
>>> Thanks for your patch.
>>>
>>> Bye Philipp
>>
>> -
>> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
>> Registration No: 1397386 (Wales)
> 
> In my humble opinion it just boils down to personal preference in this
> case. The kernel coding style guidlines don't seem to have a definitive
> gold standard regarding this. I will leave the patch as-is for now, but
> if anybody feels strongly that the () needs to be removed please feel
> free to let me know and I'll make the change.

Please consider that the person you want to sign-of for this patch is 
most likely Greg K-H. I propose to fix first what he is asking for.

Bye Philipp


  reply	other threads:[~2022-06-24  5:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23  3:15 [PATCH] staging: r8188eu: combine nested if statements into one Chang Yu
2022-06-23  4:58 ` Philipp Hortmann
2022-06-23 12:05   ` David Laight
2022-06-24  3:30     ` Chang Yu
2022-06-24  5:26       ` Philipp Hortmann [this message]
2022-06-23  5:14 ` [PATCH v2] " Chang Yu
2022-06-23  5:53   ` Philipp Hortmann
2022-06-23  9:45   ` Greg KH
2022-06-24  3:34     ` Chang Yu
2022-06-24  5:39       ` Dan Carpenter
2022-06-24  5:52         ` Chang Yu
2022-06-24  5:47       ` Philipp Hortmann
2022-06-24  5:59         ` Chang Yu
2022-06-24  6:27 ` [PATCH v3] staging: r8188eu: core/rtw_recv.c: clean up nested if statements Chang Yu
2022-06-24  6:42   ` Greg KH
2022-06-24 14:45 ` [PATCH v4] " Chang Yu
2022-06-24 18:01   ` Philipp Hortmann

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=ac6d83d6-c8b0-e0bd-10aa-a49897679edb@gmail.com \
    --to=philipp.g.hortmann@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=marcus.yu.56@gmail.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