CWARN.CONSTCOND.TERNARYCondition of ternary conditional expression is constantThe CWARN.CONSTCOND.TERNARY checker finds instances in which the condition of a ternary conditional expression 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(int a, int b, int x) { 2 int x = (x=10) ? a : b; 3 } Klocwork flags line 2, in which the result of the conditional expression will never change. |