Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
R4-5-1 Alternative tokens

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

Quote:Rule 4–5–1
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
Posted by and on behalf of
the MISRA C++ Working Group
Perfect. Thank you.
This thread is now closed

Anyone having a related question, .please start a new thread
Posted by and on behalf of
the MISRA C++ Working Group

Forum Jump:

Users browsing this thread: 1 Guest(s)