GUN特性总结

目录

__attribute__ 机制
attribute 可以设置函数属性(Function Attribute)、变量属性(Variable Attribute)和类型属性(Type Attribute)
书写特征为: attribute 前后都有两个下划线,并切后面会紧跟一对原括弧,括弧里面是相应的__attribute__ 参数
attribute 语法格式为: __attribute__ ((attribute-list))
__attribute__ 用于修饰对象时,它就如同C 语言语法体系结构的类型限定符,跟const , volatile , restrict 等属一类
__attribute__ 用于修饰函数时,它就相当于一个函数说明符,跟inline,Noreturn 属同一类。
__attribute__ 用于修饰一个结构体,联合体或者枚举类型,该限定符只能放在类型标识符之前。
当我们需要识别当前编译器能否支持GNU 语法拓展,我们可以使用 __GNU __ 宏作为区分

函数属性(Function Attribute)类型属性(Type Attributes)变量属性(Variable Attribute)
noreturnalignedalias
noinlinepackedat(address)
always_inlinebitbandaligned
flattendeprecated
constpacked
constructorweak
destructorweakref(“target”)
sentinelsection(“name”)
formatunused
format_argused
sectionvisibility(“visibility_type”)
usedzero_init
deprecated
weak
malloc
alias
warn_unused_result
nonnull
nothrow (不抛出C++ 异常)
rightrightright

参考博客

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值