Next: , Previous: , Up: C Extensions   [Contents][Index]


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.