Oodini
(Robert)
March 11, 2025, 11:02am
1
Hello,
The case of negated operand, raised as a problem by S868, inspired by MISRA, is especially irritating.
There was an other post about this subject:
Rule ID: c:S868
Rule name: # Operands of “&&” and “||” should be primary (C) or postfix (C++) expressions
Is it possible to add configuration to this rule, which parts of this rule are valid and which are not?
It is great rule for operands like && and ||, but it brings unnecessary clutter to the code with rule for ! (second example):
if (x || y && z); // Noncompliant
if (x && !y); // Noncompliant
So I propose if you can add change option to …
There is also this Jira issue, which doesn’t adress this case:
Is this rule still in MISRA C++ 2023 ?
@Fred_Tingaud Could you please give us some news ?
Thanks.
Hi @Oodini ,
Thanks for your question and sorry for the delay in my reply.
I created a ticket to follow up on this point because I agree that it is too constraining in the case of a negation operator.
The corresponding rule has evolved a lot in C++23 and negated operators no longer raise it.
Oodini
(Robert)
March 14, 2025, 3:49pm
4
Thanks ! That modification should arrive soon !
You mean MISRA C++ 23 ?