On Feb 12, 2008 8:07 PM, Oleg Verych wrote:
Daniel Drake is author of the driver for _wireless_ chip[1]. After
recognizing his ignorance, he wrote this[0]:
[0] http://lwn.net/Articles/260456/
In the above article Daniel discussed the use of __attribute__((packed))
and he stated that
" ...the compiler is aware
of the alignment constraints and will generate extra instructions to perform
the memory access in a way that does not cause unaligned access. Of course,
the extra instructions obviously cause a loss in performance compared to the
non-packed case, so the packed attribute should only be used when avoiding
structure padding is of importance. ..."
(He also gives some workarounds that might help WenZhan Song and
others to create portable code.)
Daniel's statement that the compiler can support access to unaligned
variables may seem confusing compared to the mspgcc manual
http://mspgcc.sourceforge.net/manual/x214.html
This article
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-February/014755.html
refers to the manual and states:
"This is why the packed attribute is very, very bad for the msp430."
David