JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
An unscoped enumeration (enum) with implicit underlying type contains an enumerator whose value cannot be represented in the integer type selected by the compiler for that enumeration.
An out-of-range enumerator value in a scoped enumeration, or in an unscoped enumeration with explicit underlying type, will trigger an enum Value Out of Underlying Range warning instead.
Enumerations that trigger warnings of this class will also trigger warnings of the following classes (when enabled).
This warning class is derived from a C/C++ parser warning.
| Class Name | enum Value Out of Integer Range | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | style | ||||||||||||
| Mnemonic | PARSE.EVOOIR | ||||||||||||
| Categories |
|
||||||||||||
| Availability | Available for C and C++. |
||||||||||||
| Enabling | Checks for this warning class are enabled by default.
However, warning instances of this class that are issued as parser
errors (rather than parser warnings)
will be discarded
when using factory configuration settings.
To prevent these instances from being discarded, add the
following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="enum Value Out of Integer Range" WARNING_FILTER += discard class="enum Value Out of Integer Range" |
#include <climits> // The code in this file will typically cause compiler errors. // All compilers can be expected to choose an underlying type that // is capable of representing the values in ColorUnscopedDefaultVals. enum ColorUnscopedDefaultVals { // ('Unscoped Enumeration' warning issued here when enabled) red, // red==0 orange // orange==1 }; // There are integer types capable of representing INT_MAX+1. // Many compilers will choose one of these types as the underlying type for // ColorUnscopedIntMax, in which case no 'enum Value Out of Integer Range' // warning is issued. // If the compiler does not choose one of these types, an // 'enum Value Out of Integer Range' warning is issued at the line marked ***. enum ColorUnscopedIntMax { // ('Enumeration Has Implicit Underlying Type' warning issued here when enabled) // ('Unscoped Enumeration' warning issued here when enabled) yellow=INT_MAX, green // green==INT_MAX+1 *** }; // Many compilers do not provide an integer type capable of // representing ULLONG_MAX+1. // Even compilers that provide such a type may not choose to use it as // the underlying type for ColorUnscopedUllongMax. // In these cases an 'enum Value Out of Integer Range' warning is // issued as shown below. enum ColorUnscopedUllongMax { // ('Enumeration Has Implicit Underlying Type' warning issued here when enabled) // ('Unscoped Enumeration' warning issued here when enabled) blue=ULLONG_MAX, indigo // 'enum Value Out of Integer Range' warning issued here // - indigo==ULLONG_MAX+1 };
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.