enumsalwaysint

Specifies the size of enumerated types.

Syntax
#pragma enumsalwaysint on | off | reset
  
Remarks

If you enable this pragma, the C/C++ compiler makes an enumerated type the same size as an int . If an enumerated constant is larger than int , the compiler generates an error message. Otherwise, the compiler makes an enumerated type the size of any integral type. It chooses the integral type with the size that most closely matches the size of the largest enumerated constant. The type could be as small as a char or as large as a long long .

Example of Enumerations the Same as Size as int shows an example.

Listing 1. Example of Enumerations the Same as Size as int
enum SmallNumber { One = 1, Two = 2 };
  /* If you enable enumsalwaysint, this type is
     the same size as an int. Otherwise, this type is
     the same size as a char. */

enum BigNumber 
  { ThreeThousandMillion = 3000000000 };
  /* If you enable enumsalwaysint, the compiler might
     generate an error message. Otherwise, this type is
     the same size as a long long. */

By default, this pragma is off .

Related information
aggressive_inline
dont_reuse_strings
enums_signed
errno_name
explicit_zero_data
float_constants
instmgr_file
longlong
longlong_enums
min_enum_size
pool_strings
readonly_strings
reverse_bitfields
store_object_files