I have two CPU's. One 32 bit and another 64 bit. We have a piece of C++ code like the following:
typedef std::bitset<16> MyBits;
typedef struct t_MyStruct_16 {
uint32_t first;
int16_t second;
__attribute__((__aligned__(8))) MyBits st;
} MyStruct_16;
typedef struct t_MyStruct_12 {
uint32_t first;
int16_t second;
MyBits st;
} MyStruct_12;
Is it safe to use sizeof to calculate the size of the structure for both processors 32 and 64 bit ?? What about the padded stuff, is it going to influence the behavior of the code if I do bit wise operations ?
Thank you.