Is there any reason this enum that uses a character isn't the same size as a character?
enum MyType {
Char(char),
Foo,
Bar,
Baz,
}
This datatype has the same size as a char itself at 4 octets. This makes sense as it stores the discriminant into invalid values for a character which does not use the entire 32 bits range.
However this datatype:
enum MyType {
Char(char),
Bool(bool),
}
Is twice the size of a char at 8 octets. Is there a reason for this? As it could also store the discriminant in some invalid value for a char and then use a free octet for the bool?