I use 56f8366(56800E core). According to a manual for CodeWarrior for 56800E
(Targeting_56800E, p. 125 and 126) structures are word aligned (or double word,
if they contain any double word variables). Shouldn't that also mean that
data inside the strucutres are word (dword) aligned? What I observed is (see
comments):
struct booStruct{
int dummyInt;
char singleChar;
char charArray[10];
}
main()
{
struct booStruct structInstance;
char * charPtr;
char tempChar;
structInstance.singleChar = 0x12;
structInstance.charArray[0] = 0x34;
structInstance.charArray[1] = 0x56;
...
charPtr = &structInstance.charArray[0];
tempChar = *charPtr; //ERROR afetr this line here temp char should be
//equal to 0x34, it is equal to 0x12. Moreover,
//according to debugger:
//- address of singleChar is 0x0300;
//- address of charArray[0] is 0x0300;
}
It's similiar with arrays of characters. Is that possible to align
characters (not char arrays!) inside the struct to two-byte boundaries? Just to
let pointers work correctly...