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
1430
The expression that defines the value of an enumeration constant
shall be an integer constant expression that has a value
representable as an
1431
The identifiers in an enumerator list are declared as constants that
have type
1432
An enumerator with
1433
If the first enumerator has no
1434
Each subsequent enumerator with no
1435
(The use of enumerators with
1436 The enumerators of an enumeration are also known as its members.
1437
Each enumerated type shall be compatible with
1438 The choice of type is implementation-defined,108) but shall be capable of representing the values of all the members of the enumeration.
1439
The enumerated type is incomplete until after the
1440 EXAMPLE The following fragment:
enum hue { chartreuse, burgundy, claret=20, winedark };
enum hue col, *cp;
col = claret;
cp = & col;
if (*cp != burgundy)
/* ... */
makes
1441 Forward references: tags (6.7.2.3).
1442 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.
1443 108) An implementation may delay the choice of which integer type until all enumeration constants have been seen.
Next
Created at: 2005-06-29 02:19:01
The text from WG14/N1124 is copyright © ISO