【发布时间】:2013-12-20 15:17:48
【问题描述】:
只是一个简单的问题...标准对结构成员对齐有何规定? 例如这个:
struct
{
uint8_t a;
uint8_t b;
/* other members */
} test;
保证b在struct start的偏移量1处? 谢谢
【问题讨论】:
-
我很晚才将这个添加到我的答案中,不知道我是怎么忘记的,但offsetof 可能会有所帮助。
标签: c++ c standards ansi memory-alignment