The MISRA addon looks for fallthrough cases. I do not like that checker because whenever the fallthrough is intended you must suppress a false positive with a comment. Therefore this will never be implemented in cppcheck core, but in a addon that is ok.
About infinite loops. We have "Condition is always true/false" warnings. Are there some cases that are not detected?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With the following code i have used --enable=all , --enable= warning but still not detecting the infinite loop.
#include <iostream>
using namespace std;
// starting main
int main() {
cout << "hello in test of cpp ";
for(int i = 0; i<10 ; i++ ){
cout << "in for loop";
}
for(int j = 0; j<10 ; ){
cout << "in infinite for loop";
}
switch(k){
case 1:{
cout << "hello";
break;
}
case 2:{
cout << "hello";
}
}
return 0;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am woundering why cppcheck do't allow to check infinite loops and fallthrough cases. Is their any way i can implement these checks in cppcheck.
The MISRA addon looks for fallthrough cases. I do not like that checker because whenever the fallthrough is intended you must suppress a false positive with a comment. Therefore this will never be implemented in cppcheck core, but in a addon that is ok.
About infinite loops. We have "Condition is always true/false" warnings. Are there some cases that are not detected?
With the following code i have used --enable=all , --enable= warning but still not detecting the infinite loop.