RE: [PATCH] staging: r8188eu: combine nested if statements into one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux