carlosgalvezp wrote:

> takes less time than evaluating both operands.

Actually, another reason for *not* putting this in `performance` is that the 
changes made by this check may lead to non-functional changes in the code. If 
the RHS operand is a function that has side effects, this check will change the 
logic of the code, since the RHS  may not be called due to short-circuiting, 
and maybe the caller actually intended to do so.

Performance checks are expected to only provide performance gains, without 
changes to the functionality/logic of the code.

> I think no place for this check in readability section

Readability is not so much about "making the code shorter", it's also about 
making the code explicit, without surprises. One example of that slightly 
related to this particular case is `readability-implicit-bool-conversion`. But 
like I said, I don't have a strong opinion about `readability`, it could be 
`bugprone` or `misc` too.

https://github.com/llvm/llvm-project/pull/142324
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to