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.
<http://www.codesourcery.com/archives/arm-gnu/msg02684.html>

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

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?16457>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to