Hello, lets have following code:
int resolvex(int num); int resolvey(int num); int resolve(int num,int x, int y) { if(x) { switch(num) { case 1: return resolvex(num); } } if(y) { return resolvey(num); } if(x) { return resolvex(num); } return 0; }
Online demo says: [test.cpp:6] -> [test.cpp:20]: (style) Condition 'x' is always false
However this is not true, assume x == 1, y == 0 but num != 1. In such case the second "if(x)" condition is crucial. Best regards Martin
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11822
Log in to post a comment.
Hello,
lets have following code:
However this is not true, assume x == 1, y == 0 but num != 1. In such case the second "if(x)" condition is crucial.
Best regards
Martin
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11822