CWARN.CONSTCOND.SWITCHSwitch selector expression is constantThe CWARN.CONSTCOND.SWITCH checker finds instances in which the condition of a switch statement is constant. Vulnerability and riskA constant condition for a statement typically results in the program's intention not being accomplished, with probable unexpected consequences. Vulnerable code example1 void foo() { 2 switch(3 + 2) { } 3 } Klocwork flags line 2, in which the switch selector is a constant. External guidance |