intro(3attr)
β¨ intro β C/C++ attributes β¨
okay bestie, welcome to intro(3attr) π this is the lil landing page for attributes in C and C++, and ngl it's short but it's giving foundational. let's get into it π«Ά
πΈ NAME πΈ
intro β C/C++ attributes. periodt.
π SYNOPSIS π
[[attr]]
[[vendor::attr]]
π DESCRIPTION π
so, attributes? they modify the properties of a source construct β¨ β think a type, or a variable, or a function. like a lil sticker you slap on your code that says "hey compiler, here's some extra tea about this thing" π
and the standard syntax? it also lets you name a vendor for non-standard attributes, so you can be like [[vendor::attr]] and everyone knows exactly whose attic this attribute crawled out of π
π VERSIONS π
ok so before anyone standardized attributes, C and C++ dialects were just out here doing their own thing. the lore:
__attribute__((attr))β this is the GNU syntax for attributes. it's supported by both GCC and Clang.__declspec(attr)β this is the MSVC syntax for attributes. it's supported by Clang.
β STANDARDS β
C23, C++23. iconic behavior, honestly π
π HISTORY π
the timeline of when everything showed up, in chronological-ish order of the vibes:
[[attr]][[vendor::attr]]β C23, C++11. π¦[[attr]][[gnu::attr]]β gcc 10, g++ 9, clang 9, clang++ 9. β¨__attribute__((attr))β gcc, g++, clang, clang++. (the originals, no cap π§)__declspec(attr)β clang, clang++. π
bestie reminder: that first one lists two synopsis lines under two version sets β don't let your eyes skip the second line of each pair, iykyk π
and that's the whole page, fr fr π this was Linux man-pages version 6.20, dated 2025-06-28 β shoutout to the man-pages girlies for keeping the docs immaculate, we're obsessed πππ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms