F
fdmfdmfdm
code like:
struct pid_tag{
unsigned int inactive : 1;
unsigned int : 1; /* 1 bit of padding */
unsigned int refcount : 6;
unsigned int : 0; /* pad to next word boundary */
short pid_id;
struct pid_tag *link;
}
My questions are:
1. What is this 1 bit padding? Does it mean that pad 1 bit after
integer inactive? Will this 1 bit pad have the same effect as the 0
pad below?
2. What is "pad to next word boundary"? I guess after this 0 bit
applies, the compiler will align the structure into a word boudary
according to the machine?
3. Are the word boundary alignment stops at bit-field, i.e., short int
pid_id and struct pid_tag *link are not aligned?
Thank you.
struct pid_tag{
unsigned int inactive : 1;
unsigned int : 1; /* 1 bit of padding */
unsigned int refcount : 6;
unsigned int : 0; /* pad to next word boundary */
short pid_id;
struct pid_tag *link;
}
My questions are:
1. What is this 1 bit padding? Does it mean that pad 1 bit after
integer inactive? Will this 1 bit pad have the same effect as the 0
pad below?
2. What is "pad to next word boundary"? I guess after this 0 bit
applies, the compiler will align the structure into a word boudary
according to the machine?
3. Are the word boundary alignment stops at bit-field, i.e., short int
pid_id and struct pid_tag *link are not aligned?
Thank you.