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 中字节对齐的问题

请问在ccs4.2 中怎么设置结构体的字节对齐,用于网络数据发送的。

是:}__attribute__((packed))

还是:#pragma pack(1)

编译后,两种都不行,是什么原因?

有没有其他方法,把结构体字节对齐的?