__attribute__((aligned))

__attribute__ 语法的来源

GNU C 的一大特色就是__attribute__ 机制。attribute 可以设置函数属性(Function Attribute)、变量属性(Variable Attribute)和类型属性(Type Attribute)。

attribute 语法格式为: attribute ((attribute-list))

当__attribute__ 用于修饰对象时,它就如同C 语言语法体系结构的类型限定符,跟const , volatile , restrict 等属一类。
当__attribute__ 用于修饰函数时,它就相当于一个函数说明符,跟inline,Noreturn 属同一类。
当__attribute__ 用于修饰一个结构体,联合体或者枚举类型,该限定符只能放在类型标识符之前。

常用函数属性:

__attribute__((aligned)) type attribute

aligned 属性修饰一个函数时,用于直至该函数的首地址至少需要 aligned 个字节对齐。

猜你喜欢

转载自blog.csdn.net/u012906122/article/details/103736579