C/C++

C or C++ : Switch missing default

Classification

Overview

A switch statement missing default label.

The use of default label can aid in avioding mistakes and can be used for the following reasons:

  • Perform some action if the variable has unexpected value.
  • Handle default cases, while special ones are handled under case labels.
  • The one reading the code can crearly see that all cases are covered.
LOW

DerScanner Severity Score

Check your C/C++ code for this vulnerability, free

Request a free pilot of DerScanner. We give you access and help with the first scan. It works in the cloud and on-premise.

Try it on your code, free

By submitting this form, I acknowledge that DerScanner may process my personal data I provided above for purposes explained above. More details about the processing.