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.

求助:关于使用IAR编译器开发430过程struct对齐的问题

我现在定义一个变量

#pragma pack(4)

struct test

{

  U4 a;

  U1 b;

  U4 c;

}

#pragma pack()

通过debug看变量地址发现 &c = &b+2,而不是按4字节对齐。

进一步实验发现通过pragma只能实现1字节对齐,设置成4,8字节对齐仍然是按照两字节对齐。

这个是什么问题造成的?