6.33. Specifying Attributes of Types

6.33 Specifying Attributes of Types

The keyword __attribute__ allows you to specify special attributes of types. Some type attributes apply only to struct and union types, while others can apply to any type defined via a typedef declaration. Other attributes are defined for functions (see Function Attributes), labels (see Label Attributes), enumerators (see Enumerator Attributes), statements (see Statement Attributes), and for variables (see Variable Attributes).

The __attribute__ keyword is followed by an attribute specification inside double parentheses.

You may specify type attributes in an enum, struct or union type declaration or definition by placing them immediately after the struct, union or enum keyword. A less preferred syntax is to place them just past the closing curly brace of the definition.

You can also include type attributes in a typedef declaration. See Attribute Syntax, for details of the exact syntax for using attributes.

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Type-Attributes.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部