• GUN C中的attribute


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

                                                               类型属性(Type Attribute )。

    __attribute__ 书写特征是:__attribute__ 前后都有两个下划线,并切后面会紧跟一对原括弧,括弧里面是相应的__attribute__ 参数。

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

    其位置约束为:放于声明的尾部“ ;” 之前。

    关键字__attribute__ 也可以对结构体(struct )或共用体(union )进行属性设置。大致有六个参数值可以被设定,即:aligned, packed,

                                 transparent_union, unused, deprecated 和 may_alias 。

    在使用__attribute__ 参数时,你也可以在参数的前后都加上“__” (两个下划线),例如,使用__aligned__而不是aligned ,这样,你就可以在相应的头文件里使用它而不用关心头文件里是否有重名的宏定义。

    aligned (alignment)

    该属性设定一个指定大小的对齐格式(以字节 为单位),例如:

    struct S {

    short b[3];

    } __attribute__ ((aligned (8)));

    typedef int int32_t __attribute__ ((aligned (8)));

    http://www.cnblogs.com/astwish/p/3460618.html

  • 相关阅读:
    集合(set)
    字典方法
    字典(dict)
    元组(tuple)
    列表方法
    xxxx(四):接受消息hook地址分析
    xxxx(三)“黑吃黑”: 破解别人外挂
    UDP内网穿透和打洞原理与代码实现
    VMP加壳(三):VMP壳爆破实战-破解某编辑类软件
    VMP加壳(二):VMP的虚拟化原理
  • 原文地址:https://www.cnblogs.com/-9-8/p/4652163.html
Copyright © 2020-2023  润新知