GCC编译器关键字 __attribute__ ((__packed__))
GNU C编译器中的关键字
__attribute__ ((__packed__))
取消字节对齐,紧凑排列占用内存的方式,示例1 2 3 4 5 6 7 8 9 10
| struct test1 { char c; int i; }; //占用8字节 struct __attribute__ ((__packed__)) test2 { char c; int i; }; //占用5字节
|
- 指定x字节对齐
__align(x)
-------------本文结束 感谢阅读-------------