MISRA Discussion Forums

Full Version: R4-5-1 Alternative tokens
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have a request for clarification for rule 4-5-1:

Quote:Rule 4–5–1
(Required)
Expressions with type bool shall not be used as operands to built-in operators other than the assignment operator = , the logical operators && , || , ! , the equality operators == and !=, the unary & operator, and the conditional operator.



Rule 4-5-1 and its Rationale do not seem to explicitly forbid the alternative operator representations and, or and not, which, if I understand correctly, are equivalent to the allowed &&, || and !. Rule 2-5-1 explicitly forbids digraphs, but restricts the notion of digraph to the six cases given in its Rationale.

Can I therefore interpret the rule as implicitly allowing and, or and not (and then maybe also not_eq) tokens?
You are right that the rule implicitly allows 'and', 'or', 'not' and 'not_eq'.  The C++ standard makes it clear that 'and' is simply an alternative representation of '&&' etc.

This is likely to be made explicit in the next version
Perfect. Thank you.
This thread is now closed

Anyone having a related question, .please start a new thread