intro(3attr)

intro3attr

C/c++ attributes

Usage

[[attr]]
[[vendor::attr]]

Overview

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++.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.