This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61584] What defines std::underlying_type?


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61584

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Structures-unions-enumerations-and-bit-fields-implementation.html

The integer type compatible with each enumerated type (C90 6.5.2.2, C99 and C11
6.7.2.2).
Normally, the type is unsigned int if there are no negative values in the
enumeration, otherwise int. If -fshort-enums is specified, then if there are
negative values it is the first of signed char, short and int that can
represent all the values, otherwise it is the first of unsigned char, unsigned
short and unsigned int that can represent all the values.

On some targets, -fshort-enums is the default; this is determined by the ABI.

--- CUT ---

C++ semi-follows C here, though instead of being a compatible type, it is the
underlying type.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]