How to force enum size with GCC?

1.9k Views Asked by At

To ensure binary compatibility with the product I'm working on, I need to force some of my enums to be represented by a single byte.

Since C90 allows for the compiler to chose an appropriate type (6.7.2.2 Enumeration specifiers), I would like to force the compiler to chose 8 bits.

I did expect GCC attributes to allow this, but I could not find anything here. Is there another way to handle this? (or an attribute I missed)

I'm using GCC 4.6.4 for Microblaze and C90 (I did not see a relevant option here either).

0

There are 0 best solutions below