17-10-2017, 01:36 PM
MISRA C 2012 Rule 15.7 states in the amplification that "The else statement shall contain at least either one side effect or a
comment." Does "The else statement" refers to any else statement or just the final else statement that is required
by the rule when there are one or more "else if" statements? Is the following example a violation of Rule 15.7 because the else
statement does not contain a side effect or comment or is it compliant because the else is not required by the rule?
comment." Does "The else statement" refers to any else statement or just the final else statement that is required
by the rule when there are one or more "else if" statements? Is the following example a violation of Rule 15.7 because the else
statement does not contain a side effect or comment or is it compliant because the else is not required by the rule?
Code:
typedef _Bool bool_t;
void foo(bool_t x);
void foo(bool_t x) {
if (x) {
;
}
else { }
}
<t></t>