[Asterisk-Dev] ast_flags question
Kevin P. Fleming
kpfleming at starnetworks.us
Sat Jan 8 08:06:41 MST 2005
Holger Schurig wrote:
> struct bitstruct {
> int b : 1;
> };
>
> struct bitstruct b;
<snip>
> That saves bytes and is very clear. It can be used whenever we transfer
> the struct over the wire, because the memory layout is not defined from
> compiler to compiler. But for program internal structs, this can be used
> quite nicely.
This does not save any bytes; this struct will still require 32 bits
(four bytes) for storage (see the "int" specified there?).
It's really a toss-up as to whether to do it this way or the current
way; the generated object code is pretty much identical. If it had been
my decision I would have implemented it the way you suggest, but it was
put into CVS before we got a chance to discuss it.
More information about the asterisk-dev
mailing list