On Wed, Sep 21, 2005 at 07:03:49PM +0530, Gaurav Gautam, Noida wrote: > Thanks for the reply, > > But why is there a difference in the output of same tc, with an old gcc > compiler and a new version of compiler. > > Was there a bug in the earlier gcc. > > I have a doubt. > > Gcc manual says that > > "-fshort-enums > Allocate to an enum type only as many bytes as it needs for the > declared range of possible values. Specifically, the enum type will be > equivalent to the smallest integer type which has enough room." > > Does -fshort-enum guides the size of enumeration type or the size of > enumerator constant ? C99, section 6.7.2.2: [#3] The identifiers in an enumerator list are declared as constants that have type int and may appear wherever such are permitted. ... [#4] Each enumerated type shall be compatible with char, a signed integer type, or an unsigned integer type. The choice of type is implementation-defined, but shall be capable of representing the values of all the members of the enumeration. I'm not 100% sure what #3 means for enumerators whose value does not fit in the range of "int", but it's pretty clear that the implementation is not allowed to change the type of enumerators. -- Daniel Jacobowitz CodeSourcery, LLC