MISRA Discussion Forums
R4-5-1 Alternative tokens - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.4 Standard conversions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=133)
+---- Thread: R4-5-1 Alternative tokens (/showthread.php?tid=1579)



R4-5-1 Alternative tokens - ELovisari - 23-09-2021

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?


RE: R4-5-1 Alternative tokens - misra cpp - 08-10-2021

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


RE: R4-5-1 Alternative tokens - ELovisari - 13-10-2021

Perfect. Thank you.


RE: R4-5-1 Alternative tokens - misra cpp - 11-01-2022

This thread is now closed

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