If I have a C++ struct, defining a 64bit data word such as..
struct SMyDataWord { int Name : 40; int Colour : 24; };
What does the : 40 syntax mean... does it mean that the first 40 bits are reserved for the Name and the remaining 24 bits for the Colour?
: 40
This is how it appears to be being used, but I've not come across it before.
Bitfields, carried over from C. Name is 40 bits wide, Colour is 24 bits wide. Your struct therefore has at least 64 bits. On my system 64 bits would be 8 bytes.
Name
Colour
2.1m questions
2.1m answers
60 comments
57.0k users