__attribute__((__packed__))和__attribute__((packed))之间有什么区别吗?如果一个结构是这样打包的:struct test { int a; short b; } __attribute__((__packed__)),就不需要对结构的每个成员使用each属性,因为当结构打包时
int readint(__packed int *data) return *data;为了避免填充,我在__packed声明中看到了struct属性。但是,在函数参数中使用__packed属性的好处是什么。int readint(__attribute__((packed)) int *data) return *data;
}
我们知道_attribute__((__packed__))的意思是(很可能)“不要插入任何填充以使事情更快”,也可能意味着“不要插入任何对齐以保持对齐”。struct structure2 int id1 __attribute__((__packed__)); char c __attribute__((__packed__));