S
sinbad
when should one decide to use c bitfileds.
i have a requirement where i should communicate
some data to a process. i decided to use bitfields
as follows.
struct bitfield_struct {
unsigned a_bit:1;
unsigned b_bit:1;
unsigned c_bit:1;
unsigned rbits:5;
unsigned data:24;
};
what things one should consider while using bitfields ?
and No the object defined with above struct will not be
accessed from multiple threads, it purely used to send
some data to other process by using some ipc mechanism.
surprisingly c-faq doen't have anything related bitfields.
time to add one ?
i have a requirement where i should communicate
some data to a process. i decided to use bitfields
as follows.
struct bitfield_struct {
unsigned a_bit:1;
unsigned b_bit:1;
unsigned c_bit:1;
unsigned rbits:5;
unsigned data:24;
};
what things one should consider while using bitfields ?
and No the object defined with above struct will not be
accessed from multiple threads, it purely used to send
some data to other process by using some ipc mechanism.
surprisingly c-faq doen't have anything related bitfields.
time to add one ?