What does C standard talk about mixing enumerations in the case constants of a switch-case statement? I ensure that there are no duplicate values of the mixed enum types.
switch (value) /* value is int type */
{
case enum1_val: /* enum1_val is of enum type enum1 */
break;
case enum2_val: /* enum2_val is of enum type enum2 */
break;
}
I get the code compiled clean with the -ansi -Wall flags, but Klockwork reports some problem in this code.
It's allowed in C. What you get is a warning by Klocwork because it thinks mixing different
enumtypes is not a good idea. (I personally agree on this):Quoting from Klocwork: