Re: Size of enum‏

2012-02-06 Thread Andrew Pinski
2012/2/6 Alexandre Almeida : > > Okay, I am sorry for not knowing that there is an option to make enum types > as short as possible. Anyway, I think it should be a default option. Do you > agree? No I don't agree because that would cause an ABI change. Note some targets (arm-eabi though not arm

RE: Size of enum‏

2012-02-06 Thread Alexandre Almeida
Okay, I am sorry for not knowing that there is an option to make enum types as short as possible. Anyway, I think it should be a default option. Do you agree?

Re: Size of enum‏

2012-02-05 Thread James Dennett
On Sun, Feb 5, 2012 at 12:58 PM, Jonathan Wakely wrote: > 2012/2/5 David Brown : >> >> Enum types in C++ can be any integer type big enough to cover the required >> range.  I think most C++ compilers use the smallest integer type that covers >> the range. > > With the three C++ compilers I tried e

Re: Size of enum‏

2012-02-05 Thread Jonathan Wakely
2012/2/5 David Brown : > > Enum types in C++ can be any integer type big enough to cover the required > range.  I think most C++ compilers use the smallest integer type that covers > the range. With the three C++ compilers I tried enums are int-sized for compatiblity reasons, so that enums declare

Re: Size of enum‏

2012-02-05 Thread David Brown
On 05/02/12 17:29, Alexandre Almeida wrote: What do you think about making enum types have only the size needed for the number of constants held? If an enum type has 256 constants or less, for example, it needs only one byte. If it has between 257 and 65536 constants, in the other hand, it needs

Size of enum‏

2012-02-05 Thread Alexandre Almeida
What do you think about making enum types have only the size needed for the number of constants held? If an enum type has 256 constants or less, for example, it needs only one byte. If it has between 257 and 65536 constants, in the other hand, it needs two bytes.