| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH intro 3attr 2025-06-28 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
intro \- C/C++ attributes |
| 8 |
.SH SYNOPSIS |
| 9 |
.nf |
| 10 |
.BI [[ attr ]] |
| 11 |
.BI [[ vendor :: attr ]] |
| 12 |
.fi |
| 13 |
.SH DESCRIPTION |
| 14 |
Attributes modify the properties of a source construct, |
| 15 |
such as a type, a variable, or a function. |
| 16 |
.P |
| 17 |
The standard syntax allows specifying a |
| 18 |
.I vendor |
| 19 |
for non-standard attributes. |
| 20 |
.SH VERSIONS |
| 21 |
C and C++ dialects have provided various forms of attributes |
| 22 |
before standardization. |
| 23 |
.TP |
| 24 |
.BI __attribute__(( attr )) |
| 25 |
This is the GNU syntax for attributes. |
| 26 |
It is supported by both GCC and Clang. |
| 27 |
.TP |
| 28 |
.BI __declspec( attr ) |
| 29 |
This is the MSVC syntax for attributes. |
| 30 |
It is supported by Clang. |
| 31 |
.SH STANDARDS |
| 32 |
C23, C++23. |
| 33 |
.SH HISTORY |
| 34 |
.TP |
| 35 |
.BI [[ attr ]] |
| 36 |
.TQ |
| 37 |
.BI [[ vendor :: attr ]] |
| 38 |
C23, C++11. |
| 39 |
.TP |
| 40 |
.BI [[ attr ]] |
| 41 |
.TQ |
| 42 |
.BI [[gnu:: attr ]] |
| 43 |
gcc 10, g++ 9, clang 9, clang++ 9. |
| 44 |
.TP |
| 45 |
.BI __attribute__(( attr )) |
| 46 |
gcc, g++, clang, clang++. |
| 47 |
.TP |
| 48 |
.BI __declspec( attr ) |
| 49 |
clang, clang++. |