David Hawkins wrote: >Tom Walsh wrote: > > > >>>So, I never used bit-fields again ... >>> >>> > >Ok, So 'I never had a reason to use bit-fields since then' :) > > > >>Bitfields are usefull for tearing apart bit-packed fields within data or >>assembling it. While you are correct in stating that use of a bitfield >>against a register which expects a finite length operation (32 bit in >>your case), it is not correct to condemn then out of hand just because >>you had a bad experience. "you burn you learn"... >> >> > >Yes, this was definitely a learning experience - one I am sure >others will face - except perhaps for those reading this >thread. > >Thanks for the pointers on legitimate uses of bit-fields. > >Here's a question for you. What happens on different-endianness >machines regarding bit-fields? Eg. lets say you analyze FAT headers >(which was discussed a few emails back). If I recall correctly, >they used bitfields and packed structures. > >Do the layouts of entries match on different endianness machines, >or do you have to be careful there too? > > > There has been much written about problems with Big-Endian processors and thier data, esp with type conversions. I'll stick to Little-Endian. TomW > > -- Tom Walsh - WN3L - Embedded Systems Consultant http://openhardware.net, http://cyberiansoftware.com "Windows? No thanks, I have work to do..." ----------------------------------------------------
Message
Re: [lpc2000] Bit-fields are brain-dead (was Looking to buy compiler)
2005-11-09 by Tom Walsh
Attachments
- No local attachments were found for this message.