[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


enumsalwaysint

Description:

Specifies the size of enumerated types.

Compatibility:

This pragma is compatible with the following platform targets:

68K

PowerPC

NEC V800

Intel x86

MIPS

Embedded 68K

Prototype:
  #pragma enumsalwaysint on | off | reset Remarks:

When pragma enumsalwaysint is on, the C or C++ compiler makes an enumerated types the same size as an int. If an enumerated constant is larger than int, the compiler generates an error. When the pragma is off, 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.

For example:


enum SmallNumber { One = 1, Two = 2 };
  /* If enumsalwaysint is on, this type will
     be the same size as a int. 
     If the pragma is off, this type will be
     the same size as an char. */

enum BigNumber 
  { ThreeThousandMillion = 3000000000 };
  /* If enumsalwaysint is on, the compiler may
     generate an error. 
     If this pragma is off, this type will
     be the same size as a long int. */

For more information on how the compiler handles enumerated types, see "Enumerated Types."

This pragma corresponds to the Enums Always Int option in the C/C++ Language Panel. To check whether this option is on, use __option (enumsalwaysint), described in "Checking Options."


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000