by guenter » 22 Jan 2007, 20:01
As far as I know, no.
For portable code, packing is rather problematic, because some architectures do not like misaligned data at all. In the best case, on this platforms, you'll experience a huge performance penalty for a misaligned access. In the worst case, your program will crash. If you need portable data alignment, the best thing is to align all data at boundaries corresponding to their byte size. E.g., put every 16-bit integer on an address where addr mod 2 == 0, every 32-bit integer on an address where addr mod 4 == 0, etc.