Previous Table of Contents "New C Standard" commentary
enum-specifier: enum identifieropt { enumerator-list } enum identifieropt { enumerator-list , } enum identifier
enumerator-list: enumerator enumerator-list , enumerator
enumerator: enumeration-constant enumeration-constant = constant-expression
1440
The expression that defines the value of an enumeration constant
shall be an integer constant expression that has a value
representable as an
1441
The identifiers in an enumerator list are declared as constants that
have type
1442
An enumerator with
1443
If the first enumerator has no
1444
Each subsequent enumerator with no
1445
(The use of enumerators with
1446 The enumerators of an enumeration are also known as its members.
1447
Each enumerated type shall be compatible with
1448 The choice of type is implementation-defined,108) but shall be capable of representing the values of all the members of the enumeration.
1449
The enumerated type is incomplete until after the
1450 EXAMPLE The following fragment:
enum hue { chartreuse, burgundy, claret=20, winedark };
enum hue col, *cp;
col = claret;
cp = & col;
if (*cp != burgundy)
/* ... */
makes
1451 Forward references: tags (6.7.2.3).
1452 107) Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from each other and from other identifiers declared in ordinary declarators.
1453 108) An implementation may delay the choice of which integer type until all enumeration constants have been seen.
Next
Created at: 2008-01-30 02:39:43
The text from WG14/N1256 is copyright © ISO