Attributes by Usage
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Attributes by Usage

This topic lists attributes according to the C++ language elements to which they apply.

If an attribute precedes a Visual C++ element that is not in the attribute's scope, the attribute block is treated as a comment.

Attribute Description
Module Attributes Applies to the module attribute.
Interface Attributes Applies to the __interface C++ keyword.
Class Attributes Applies to the C++ keyword.
Method Attributes Applies to the methods in a class, coclass, or interface.
Parameter Attributes Applies to parameters of a method in a class or interface.
Data Member Attributes Applies to the data members in a class, coclass, or interface.
Typedef, Enum, Union, and Struct Attributes Applies to the C++ keywords.
Array Attributes Applies to arrays or SAFEARRAYs.
Stand-Alone Attributes Operates more like a line of code but does not operate on a C++ keyword. Stand-alone attribute statements require a semicolon at the end of the line.

See Also

C++ Attributes Reference | Attributed Programming | Attributes by Group | Attributes Alphabetical Reference

© 2016 Microsoft