From what I know (from what I read in the cpp-programming-language) the size would be the size of “some integral type that can hold its range and not larger than sizeof(int), unless an enumerator cannot be represented as an int or as an unsigned int”.
But is it possible to define the size in some way? For example, I would like to use an enum whose sizeof is the size of the natural word (usually unsigned long).
You can in C++11:
(You can specify the size of an enum either for the old-style
enumor the new-styleenum class.)You can also increase the minimum size of an enum by fun trickery, taking advantage of the last phrase of the sentence that you cited:
…which will ensure that the enum is at least 32-bit.