Re: [gtk-list] Re: offtopic colons and gtk (;



>This means that those fields use that many bits.  The compiler
>generates code which packs has_selection, editable and visible in the
>same guint.  They are just bits in that guint.  You don't have to
>think of them as bits, as you access them normally.  But that is what
>they are.  Pablo

Well, not necessarily packed. The standard doesn't specify whether they are or 
not. A compiler is perfectly allowed to put each bitfield in an int of its 
own, regardless of how long it is. (This is one of my pet peeves about 
bitfields, which would otherwise be extremely useful. You can't portably do:

typedef union {
	guint value;
	struct {
		unsigned field1 : 3;
		unsigned field2 : 4;
		unsigned field3 : 1;
	} bit;
}

...and get sensible results.)

-- 
+- David Given ---------------McQ-+ 5 router.blackhole.sol.mw (42.42.42.42)
|  Work: dg@tao-group.com         | 624810293.843 ms * *
|  Play: dgiven@iname.com         | 6 * * *
+- http://wired.st-and.ac.uk/~dg -+ 7 * * *




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]