Hi Jan,
On 01/04/2020 13:07, Jan Beulich wrote:
On 01.04.2020 14:00, Julien Grall wrote:
On 27/03/2020 18:50, Paul Durrant wrote:
+ if ( (exact ?
+ (dst_len != c->desc.length) : (dst_len < c->desc.length)) ||
Using ternary in if is really confusing. How about:
dst_len < c->desc.length || (exact && dst_len != c->desc.length) ||
I understand that there would be two check for the exact case but I think it is
better than a ternary.
I'm of the opposite opinion, and hence with Paul. While the alternative
you suggest is still reasonable because of the special case here, I
find it confusing / more difficult to read / follow
if ( (a && b) || (!a && c) )
(and I've seen quite a few instances of such over time) instead of
if ( a ? b : c )
If the ternary was the only condition and in a single line then it would
be okay. However, the if is split over 3 lines...
The more stuff you put in an if, then more chance you are going to
misread/make a mistake (you likely know what I am referring about here ;)).
So if you prefer the ternary, then we should at least write 2 ifs.
Cheers,
--
Julien Grall