Re: [Evolution-hackers] Why a bitfield in CamelOfflineFolder?



On Thu, 2006-11-30 at 10:23 +0000, Ross Burton wrote:
> On Thu, 2006-11-30 at 11:07 +0100, Jules Colding wrote:
> > Sorry, I must be dim-witted here, but I don't understand your answer.
> > The present definition of CamelOfflineFolder has:
> > 
> > unsigned int sync_offline:1;
> >                          ^^    <== bit field 
> > 
> > I'm asking why we don't simply do:
> > 
> > gboolean sync_offline;
> > 
> > instead?
> 
> I'm presuming to save memory -- maybe the folder is nested in another
> struct and the compiler can compact the bitfields into a single word.
> 
> However that doesn't appear to be the case so in this situation a
> gboolean would use the same amount of memory as the int:1.  I'm guessing
> this was a style choice: always use a bitfield so future boolean flags
> are compacted.

A bit over-designed (and not consequently applied to other data
structures) if I may say so...


Thanks,
  jules





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