...
Noncompliant Code Example (switch
)
The following This noncompliant code example fails to consider all possible cases. Failure to account for all valid values of type Color
will result in a logic error. Because valid values of an enumerated type include all those of its underlying integer type, unless enumeration constants have been provided for all those values, the default
label is appropriate and necessary.
...
Compliant Solution (switch
)
The following This compliant solution takes care to provide the default
label to handle all valid values of type Color
:
...