请问在ccs4.2 中怎么设置结构体的字节对齐,用于网络数据发送的。
是:}__attribute__((packed))
还是:#pragma pack(1)
编译后,两种都不行,是什么原因?
有没有其他方法,把结构体字节对齐的?
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.
请问在ccs4.2 中怎么设置结构体的字节对齐,用于网络数据发送的。
是:}__attribute__((packed))
还是:#pragma pack(1)
编译后,两种都不行,是什么原因?
有没有其他方法,把结构体字节对齐的?
可以用STRUCT_ALIGN,具体可以参考下面的文档第178页。
http://www.ti.com/lit/ug/spru187v/spru187v.pdf