Follow-up Comment #2, bug #16457 (project freeciv):

> I did many tests to try to get enumerators of size 1 or 2, but I failed to
get it.
I think the C standard permits sizeof(enumerated type) != sizeof(int), but
it's rarely used.

> Maybe gcc requires a special option for it?
I think it forms part of the ABI -- if you had different object files (/
dynamic link libraries, etc) compiled with and without such an option, they
could misbehave when linked together due to disagreement over the size of
objects. So in practical terms, I think it's a property of the platform. I
think there is an ARM ABI that has enums fit in the smallest possible space,
but I suspect it's not part of any common Intel ABI, for instance. Here's
another example.

> Would sizeof(enum blah) return the real size of the type?
I believe so.


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to