Skip to content

Instantly share code, notes, and snippets.

@aakbar5
Last active Jul 19, 2016
Embed
What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment