Next: , Previous: Strings, Up: Types

5.7 Enumerations

Enumerations are defined with the ‘e’ type descriptor.


The source line:

     enum e_places {first,second=3,last};

generates the following stab:


The symbol descriptor (‘T’) says that the stab describes a structure, enumeration, or union tag. The type descriptor ‘e’, following the ‘22=’ of the type definition narrows it down to an enumeration type. Following the ‘e’ is a list of the elements of the enumeration. The format is ‘name:value,’. The list of elements ends with ‘;’. The fact that value is specified as an integer can cause problems if the value is large. GCC 2.5.2 tries to output it in octal in that case with a leading zero, which is probably a good thing, although GDB 4.11 supports octal only in cases where decimal is perfectly good. Negative decimal values are supported by both GDB and dbx.

