CrossWorks offers type-based enumerations, an extension to the ISO standard to set the size of enumeration types. You can use type-based enumerations to select the base type for your enumeration. Using type-based enumeration you can reduce the size of your application by using enumerations that match the size of the underlying data rather than using the default int-based enumeration.


enum [base-type]

Where base-type is either a plain, signed, or unsigned variant of char, int, long, or long long.


Use an 8-bit unsigned character to define an enumeration that maps onto a single byte and map that onto a byte at location 10016:

enum unsigned char T0CN_t {
  M0   = 1<<0,
  M1   = 1<<1,
  CT   = 1<<2,
  GATE = 1<<3,
  TR0  = 1<<4,
  TF0  = 1<<5,
  T0M  = 1<<6,
  ET0  = 1<<7

enum T0CN_t T0CN __at 0x100;