NAME
intro - C/C++ attributes
SYNOPSIS
[[attr]] [[vendor::attr]]
DESCRIPTION
Attributes modify the properties of a source construct, such as a type, a variable, or a function.
The standard syntax allows specifying a vendor for non-standard attributes.
VERSIONS
C and C++ dialects have provided various forms of attributes before standardization.
- __attribute__((attr))
-
This is the GNU syntax for attributes. It is supported by both GCC and Clang.
- __declspec(attr)
-
This is the MSVC syntax for attributes. It is supported by Clang.
STANDARDS
C23, C++23.
HISTORY
- [[attr]]
[[vendor::attr]] -
C23, C++11.
- [[attr]]
[[gnu::attr]] -
gcc 10, g++ 9, clang 9, clang++ 9.
- __attribute__((attr))
-
gcc, g++, clang, clang++.
- __declspec(attr)
-
clang, clang++.