attribute
1、gnu C的特性
2、__attribute__可以对函数、变量、类型设置属性
3、语法格式
__attribute__ ((attribute-list))
4、attribute 可设置的属性
1)aligned指定对齐方式
# 指定4字节对齐
struct {
...
} __attribute__ ((aligned (4)));
2)packed内存紧凑约束,相当于是1字节对齐
# 结构体内部1字节对齐,但是结构体内部的结构体不会受此约束
struct {
...
} __attribute__ ((__packed__));
3)at给变量或函数指定绝对地址
# 给变量a指定物理地址xxxxx
int a __attribute__ ((at (xxxxx)));