enum size compiler option
-
Is there any way in VC++ to make an enum field take the smallest possible size needed for that enumeration instead of 4 bytes?
-
Is there any way in VC++ to make an enum field take the smallest possible size needed for that enumeration instead of 4 bytes?
Hi, Answer for U r q? The #pragma enum directive specifies the size of enum variables that follow. The size at the left brace of a declaration is the one that affects that declaration, regardless of whether further enum directives occur within the declaration. This pragma pushes a value on a stack each time it is used, with a reset option available to return to the previously pushed value. usage :- #pragma enum (suboptions) where available suboptions are: small enum size is the smallest integral type that can contain all variables. int enum size is 4 1 enum size is 1 2 enum size is 2 4 enum size is 4 8 enum size is 8. int enum size is 4 intlong Specifies that enumerations occupy 8 bytes of storage and are represented by long long if the range of the constants exceed the limit for int. Otherwise, the enumerations occupy 4 bytes of storage and are represented by int. small enum size is the smallest integral type that can contain all variables. pop the option will reset the enum size to the one before the previously set enum size. reset the option is an alternative method of resetting the enum size to the one before the previously set enum size. This option is provided for backwards compatibility. by baijumax
-
Hi, Answer for U r q? The #pragma enum directive specifies the size of enum variables that follow. The size at the left brace of a declaration is the one that affects that declaration, regardless of whether further enum directives occur within the declaration. This pragma pushes a value on a stack each time it is used, with a reset option available to return to the previously pushed value. usage :- #pragma enum (suboptions) where available suboptions are: small enum size is the smallest integral type that can contain all variables. int enum size is 4 1 enum size is 1 2 enum size is 2 4 enum size is 4 8 enum size is 8. int enum size is 4 intlong Specifies that enumerations occupy 8 bytes of storage and are represented by long long if the range of the constants exceed the limit for int. Otherwise, the enumerations occupy 4 bytes of storage and are represented by int. small enum size is the smallest integral type that can contain all variables. pop the option will reset the enum size to the one before the previously set enum size. reset the option is an alternative method of resetting the enum size to the one before the previously set enum size. This option is provided for backwards compatibility. by baijumax
Where are you getting that info? I don't see
#pragma enum
in the VC 6 or 7 docs. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Pinky, are you pondering what I'm pondering? I think so Brain, but if we shaved our heads, we'd look like weasels! -
Where are you getting that info? I don't see
#pragma enum
in the VC 6 or 7 docs. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Pinky, are you pondering what I'm pondering? I think so Brain, but if we shaved our heads, we'd look like weasels!