Hi, > In reply to Chris' post - The IAR compiler handles such structures by > accessing the data byte by byte. So, assigning the value, 0x1234 to "hg.b" > (odd memory location) is done one byte at a time, i.e. 0x34 is moved in > first and then 0x12 is moved into the next higher byte. As Chris rightly > pointed out, it would've been nice if mspgcc could generate similar code :-)
i don't agree because a) this produces more (assembler) code which needs more flash, b) it's slower and c) it's not necessary when you do define your struct as { int i; char c; } instead of the ugly { char c; int i; } . You should follow the generally rule that a struct should start with the greatest member and that the member n should be smaller or equal then member n-1. But you also have to bear in mind the alignment. Regards, Rolf