### 6.35 Specifying Attributes of Types

The keyword `__attribute__` allows you to specify various special properties of types. Some type attributes apply only to structure and union types, and in C++, also class types, while others can apply to any type defined via a `typedef` declaration. Unless otherwise specified, the same restrictions and effects apply to attributes regardless of whether a type is a trivial structure or a C++ class with user-defined constructors, destructors, or a copy assignment.

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 enclosed in 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. You can also place them just past the closing curly brace of the definition, but this is less preferred because logically the type should be fully defined at the closing brace.

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