intro − C/C++ attributes
[[attr]]
[[vendor::attr]]
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.
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.
C23, C++23.
[[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++.