The Meaning of Rule 12.6? - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA-C: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17) +---- Forum: 6.12 Expressions (https://forum.misra.org.uk/forumdisplay.php?fid=39) +---- Thread: The Meaning of Rule 12.6? (/showthread.php?tid=240) |
The Meaning of Rule 12.6? - Hammer - 06-04-2006 I am trying to understand this rule and need someone to clarify its exact meaning. which of the following are violations of Rule 12.6? Code: if((x==y)|(y==a))/*Violation?, could || have been meant?*/ Code: a=a+y+x+(x||y); Code: int32_t x=5; Thanks for you help! - misra-c - 27-04-2006 Code: if ( ( x == y ) | ( y == a ) ) /*Violation?, could || have been meant?*/ These are violations of 12.6. as effectively boolean expressions are being used as the operand of an operator other than &&, || and !. Code: int32_t x = 5; This is a violation of the first sentence of 12.6. |