Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
Visible to Intel only — GUID: GUID-32F4DE72-DE11-4A6A-AA65-288A49DC9306
Visible to Intel only — GUID: GUID-32F4DE72-DE11-4A6A-AA65-288A49DC9306
Attributes
Attributes are a way to provide additional information to the compiler. The C2x attribute syntax is consistent with the C++11 standard.
Use Attributes
The compiler supports three ways to add attributes to your program:
- GNU Syntax
__attribute__((attribute_name(arguments)))
- Microsoft Syntax
__declspec(attribute_name(argument))
- C++11 Standardized Attribute Syntax (part of the C++11 language standard)
[[attribute_name(arguments)]]
[[attribute-namespace :: attribute_name(arguments)]]
Some attributes are available for both Intel® microprocessors and non-Intel microprocessors but they may perform additional optimizations for Intel® microprocessors than they perform for non-Intel microprocessors. Refer to the individual attribute name for a detailed description.
- align
Directs the compiler to align the variable to a specified boundary and a specified offset. - align_value
Provides the ability to add a pointer alignment value to a pointer typedef declaration. - allow_cpu_features
Provides the ability for a function to use intrinsic functions and architecture-specific functionality. - const
Indicates that a function has no effect other than returning a value and that it uses only its arguments to generate that return value. - cpu_dispatch, cpu_specific
Provides the ability to write one or more versions of a function that execute only on a list of targeted processors (cpu_dispatch). Provides the ability to declare that a version of a function is targeted at particular types of processors (cpu_specific). - target
Specifies a target for called functions or variables.