vendredi 31 juillet 2015

Are enums by default unsigned? [duplicate]

This question already has an answer here:

enum Color
 {
   GREY = 4294967294,
   RED 
 }

RED is assigned the largest value a 4 byte unsigned int can hold. When I use sizeof to know the size of my enum Color (sizeof (Color)), it prints 4. If I assign -1 to RED, the sizeof prints 8. Does that mean an enum is by default unsigned?

Aucun commentaire:

Enregistrer un commentaire