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 of the same size as 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.

The following listing shows an example.

Listing: 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. */