G++ enums 'underlying type'
Richard Earnshaw
rearnsha@gcc.gnu.org
Tue Jan 4 14:18:00 GMT 2005
On Wed, 2004-12-29 at 18:12, Gabriel Dos Reis wrote:
> In C, enumerator are ints -- even though the associated enumeration
> type is considered a distinct types. Only C++ allows for the smallest
> integer type as the underlying type; and C++ enumerators are not ints.
In C, enumeration *constants* are ints. Enumeration *variables* need
not be: they can be any integral type ([unsigned] [char|short|int]) that
can hold the entire range of the enumeration set.
R.
More information about the Gcc
mailing list