enum as bitfield

By default enum can't be as bitfield
typedef enum _type_ {
CAT = 0,
DOG,
UNKNOWN
} TYPE;
typedef struct _animal {
TYPE type : 2;
};
GCC ((Sourcery CodeBench 2015.17-10) 5.2.0) will show error "width of 'type' exceeds its type"
Use -fno-short-enums to get rid of this. Details: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0774b/chr1411640303038.html

view raw
enum as bitfield
hosted with ❤ by GitHub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s