Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is particularly problematic in C, because an identifier declared as an enumeration constant has type int. ThereforeAs a result, a programmer can accidentally assign an arbitrary integer value to an enum type, as shown in this example.

...

Microsoft Visual C++ .NET with /W4 does not warn when assigning an integer value to an enum type, or when the switch statement does not contain all possible values of the enumeration.

...

These two practices have now been merged.  A switch on an enum type should now contain a case label for each enum value, but should also contain a default label for safety.  This is no not more difficult to analyze statically.

...

Failing to take into account all possibilities within a logic statement can lead to a corrupted running state, possibly potentially resulting in unintentional information disclosure or abnormal termination.

...