Re: How big is an enum?

From: Tom Tanner (
Date: 10/17/03

Date: Fri, 17 Oct 2003 09:23:07 +0100

unix_mathi wrote:
> Enums are integers.So it occupies 4 bytes.

(Cutting in at the end of the conversation) They /could/ be smaller. The
compiler is entitled to store an enum in a short or a byte of the enum
range is appropriate. (Not that many do).


Relevant Pages

  • binary -> enum
    ... in stock at dozens of online stores and displays the current in-stock ... I used a boolean to track whether a given product was in-stock at each ... I used an enum for NOTCARRIED, ... store as a bit in an int, to code that used 2 bits in a long, but I ...
  • Collection of Enum with additional properties
    ... I was to track some additional properties around an enum I have - for ... I also need to be able to store and manage a collection of these ... EnumDescriptor objects... ... collection class by inheriting from the the ...
  • Re: BIT banging help
    ...  how many enum values can I store with a long? ... store as a bigint in sqlserver). ... I want to be able to AND and OR each permission enum value, ...
  • Re: how to parse an Enum Structure in
    ... Storing the names is something that should be considered in some cases, ... In other cases the names have no natural numbering at all, then it might be better to store the names. ... You can just as easily assign numbers to each enum value, i.e., ... Filibuster = 25 ...
  • Re: Enum
    ... So trying to store both ... Required and Validate in a variable declared as Mode is like trying to ... You are going to need a third item in the Enum. ... RequiredValidate? ...