I came across this question about the main types of enums, where the answers quote Standard C ++ 7.2 / 5 as:
The basic type of an enumeration is an integral type that can represent all the values ββof an enumeration defined in an enumeration. An implementation is defined that is an integral type as the base type for the enumeration, except that the base type must not be greater than int if the enumerator value cannot be placed in int or unsigned int.
This is pretty clear for all reasonable cases. But what happens if I make an enum so ridiculously large that it can't even fit in for a long time?
(I donβt know why this has ever happened in practice, but maybe I feel destructive and have a free day)
Is this behavior a standard?
c ++ enums types size
Bear Sep 21 '16 at 15:30 2016-09-21 15:30
source share