Thoughts on enum types and bit packing
Posted: Tue Jun 23, 2020 5:06 pm
So I want other people's opinions on a couple of programming practices I've been using on and off.
First using enum types (in C) to define multiple constants in a group, for example creating a enum type for GDT flags bitmasks.
I know I'm making a type for these constants that I never actually use but should I just convert this into a series of #defines?
And then if I use bit packed structs to make bitmasks using bool types for values that don't have a particular location ie a set of flags for my own implementation of driver management, would I have to worry about different compilers putting bits in different orders?
First using enum types (in C) to define multiple constants in a group, for example creating a enum type for GDT flags bitmasks.
I know I'm making a type for these constants that I never actually use but should I just convert this into a series of #defines?
And then if I use bit packed structs to make bitmasks using bool types for values that don't have a particular location ie a set of flags for my own implementation of driver management, would I have to worry about different compilers putting bits in different orders?