enumsalwaysint

Specifies the size of enumerated types.

Syntax
  #pragma enumsalwaysint on | off | reset  
Remarks

If you enable this pragma, the 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. 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 int.

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



     short int. */



enum BigNumber 



  { ThreeThousandMillion = 3000000000 };



  /* If you enable enumsalwaysint, the compiler might



     generate an error. Otherwise, this type is



     the same size as a long int. */

This pragma corresponds to the Enums Always Int setting in the Language panel. To check this setting, use __option (enumsalwaysint), described in Checking Pragma Settings. By default, this pragma is disabled.

Note: The size of a char on the DSP56800 target is 16 bits, and 8 bits on the DSP56800E.