lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06893216a5a04d7e84dfe3e132d333f6@AcuMS.aculab.com>
Date:   Thu, 23 Jun 2022 12:05:40 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Philipp Hortmann' <philipp.g.hortmann@...il.com>,
        Chang Yu <marcus.yu.56@...il.com>,
        "Larry.Finger@...inger.net" <Larry.Finger@...inger.net>
CC:     "linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] staging: r8188eu: combine nested if statements into one

...
> 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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ