Given:
enum week { sunday=0, monday, tuesday, wednesday, thursday, friday, saturday }; enum week day = saturday; day ++;
the value of day is 7 .
Quote from ISO C 2011, clause 6.7.2.2, clause 1:
Each numbered type must be compatible with char , signed integer type, or unsigned integer type. The choice of type is defined by the implementation, but should be able to represent the values โโof all members of the enumeration.
_Bool is an unsigned integer type, but it does not meet the requirements for this particular type of enumeration.
Since the CHAR_BIT value requires at least 8 , and the char , unsigned char and signed char types require no fill bits, the types of each character must span at least 0 through 127 . Wider integer types ( short , int , etc.) have ranges that are at least the same as signed char or unsigned char . Therefore, an implementation type compatible with enum week must have a lower bound of at most 0 and an upper bound of at least 127 .
( WARNING .). There may be a loophole that allows extended integer types with a wider range than _Bool , but a narrower range than char . For example, I think an extended integer type with a size of 8 bits, but only 3 bits of the value will be legal. But since integer types are required to use the binary representation, an unsigned type with 3 bits of value can represent values โโfrom 0 to 7, and an unsigned type with 2 bits of value cannot represent the value of saturday , since enum week can contain the value 6 , it should also be able to hold value 7 . In an unusual implementation, he will not be able to represent the value 8 , but you are unlikely to come across such an implementation.
Basically, given the requirement that integer types use a pure binary representation, any type that can represent 6 can also represent 7 , although it does not automatically follow that it can also represent 8 .