lkml.org 
[lkml]   [2020]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] locking/rwsem: Fix kernel crash when spinning on RWSEM_OWNER_UNKNOWN
Date
From: Waiman Long
> Sent: 15 January 2020 15:48
...
> It depends. I find it hard to read an expression with "&" and "&&"
> without parentheses. Anyway, I will admit that the above code is
> inconsistent in term of how parentheses are used. So I will change that.

Conditionals containing fragments like (a == b && c == d && ...)
are much easier to read without any extra ().

The only problem with && is that when K&R added it to C they didn't
change the priority of & to be higher than == (where it should be).
At that time they could have changed all the existing code...
Modern compilers do warn about (a == b & c).

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
\
 
 \ /
  Last update: 2020-01-15 17:02    [W:0.038 / U:1.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site