...
| Code Block | ||||
|---|---|---|---|---|
| ||||
int func(int expr) {
switch(expr){
int i = 4;
f(i);
case 0:
i = 17;
/* fallsFalls through into default code */
default:
printf(“%d\nâ€, i);
}
return 0;
}
|
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
int func(int expr) {
int i = 4; /* Move the code outside the switch block */
f(i); /* Now the statements will get executed */
switch(expr) {
case 0:
i = 17;
/*falls Falls through into default code */
default:
printf(“%d\nâ€, i);
}
return 0;
}
|
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
MSC35-C | medium | unlikely | medium | P4 | L3 |
Related Guidelines
| MISRA-C | Chapter 6.14 |
...