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