diff -r 4891d49809bb -r 2b3996fc09a1 core/com.nokia.carbide.cpp.compiler.doc.user/html/pragmas/p_enumsalwaysint.htm --- a/core/com.nokia.carbide.cpp.compiler.doc.user/html/pragmas/p_enumsalwaysint.htm Mon Jul 19 15:31:48 2010 -0500 +++ b/core/com.nokia.carbide.cpp.compiler.doc.user/html/pragmas/p_enumsalwaysint.htm Mon Jul 19 16:13:24 2010 -0500 @@ -1,39 +1,39 @@ - - - - - - - enumsalwaysint - - - - -

enumsalwaysint

-

Specifies the size of enumerated types.

-
Syntax
-

#pragma enumsalwaysint on | off | reset -

-
Targets
- All platforms.
-
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. If this pragma is not enabled, 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. Listing 10.15 shows an example.

-
-

Listing 10.15 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.
- Otherwise, this type is the same size as a long long. */

-
-

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

-

This pragma corresponds to the Enums Always Int setting . To check this setting, use __option (enumsalwaysint), described in Checking Settings. The default setting is off.

-

- - - - - + + + + + + + enumsalwaysint + + + + +

enumsalwaysint

+

Specifies the size of enumerated types.

+
Syntax
+

#pragma enumsalwaysint on | off | reset +

+
Targets
+ All platforms.
+
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. If this pragma is not enabled, 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. Listing 10.15 shows an example.

+
+

Listing 10.15 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.
+ Otherwise, this type is the same size as a long long. */

+
+

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

+

This pragma corresponds to the Enums Always Int setting . To check this setting, use __option (enumsalwaysint), described in Checking Settings. The default setting is off.

+

+ + + + +