This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

struct alignment/pragma pack() question

I have a structure that I think should be sizeof(mystruct) = 9 but sizeof(mystruct) is returning 10. the struct has a unsigned short, a float, and 6 unsigned char.

I thought it might be a packing issue. When I use #pragma pack(), I get a warning about unknown pragma.

I am using code composer studio 6 and a F28069.

  • The C2000 compiler does not support packing structures, with #pragma pack or any other method.  The float must be on an even word boundary.  So that is why there is a  one word gap between the unsigned short and the float.

    Thanks and regards,

    -George