Re: C question



> Do not use bit fields in C. From page 150 of the second
> edition of Kernighan and Ritchie, "The C Programming
> Language", ISBN 0131103628:

Yes and no.

Some processors offer "near" and "far" memory. Typically (as is true for
the 68HC08 and TMS370C8 cores) bitfield operations on bitfields of size 1
which are in "near" memory come down to a single machine instruction (a
direct-addressed OR, AND, or BTBC instruction). Using a bitfield of size 1
on these machines is vastly superior to a variable declared outside a
structure.

Generally, the breakdown is:

a)Bitfields of size 1 in near memory on small machines often work well.

b)Bitfields of size 8 or UCHARS on more powerful machines often work well.

c)Bitfields of other sizes have questionable value in embedded work. The
code to extract and pack the fields is often bulky.

However, on larger machines, as long as one understands the tradeoffs,
bitfields of unusual sizes can be useful. For example, if I were
implementing chess on a PDA and had to build a large game tree in limited
RAM, I would pack things, knowing that I would make the game tree smaller at
the expense of size and speed of the code that deals with it.



.



Relevant Pages

  • Does GPO Deployment of XP SP2 make a local cached copy on clients?
    ... they mention 4 ways to deploy the service pack. ... local cache of the source files on the client machines afterwards so ... machines with the equivalent of a client-side cache of the install ... I'd rather not tether them to the server for system files they may ...
    (microsoft.public.windowsxp.setup_deployment)
  • Why does the Network browser sometimes just pack up?
    ... machines and clients, I have seen the Network browsing function just ... completely pack up. ...
    (uk.comp.sys.mac)
  • Re: MS selling old Xboxes as new
    ... wireless controllers are in fact OLD machines. ... arcade pack or 269 Euro's for the Premium pack ... Edwin goes away, and two of his sockpuppets come ... And, as is the trend of Edwin's sockpuppets, this one is ...
    (comp.sys.mac.advocacy)
  • Re: [SLE] One Suse 10 (retail Box) For Multiple Installation In Private Organisa
    ... I'd set an internal policy like "for every 10 machines ... except for two sites having between one and three workstations. ... have been setup as a ISDN multi-star-ring network of five major hubs. ... they have one pack per server, one pack per five workstations for the two ...
    (SuSE)
  • Re: MS selling old Xboxes as new
    ... wireless controllers are in fact OLD machines. ... arcade pack or 269 Euro's for the Premium pack ... And, as is the trend of Edwin's sockpuppets, this one is ... Dave Fritzinger ...
    (comp.sys.mac.advocacy)