Since C++11, C++ has supported attribute specifier sequences.<ref>{{cite web|title=Attribute specifier sequence (since C++11)|url=https://cppreference.com/w/cpp/language/attributes.html|website=cppreference.com|access-date=6 June 2025}}</ref>. Attributes can be applied to any symbol that supports them, including classes, functions/methods, and variables, and any symbol marked with an attribute will be specifically treated by the compiler as necessary. These can be thought of as similar to [[Java annotation]]s for providing additional information to the compiler, however they differ in that attributes in C++ are not metadata that is meant to be accessed using reflection. Furthermore, one cannot create custom attributes in C++, unlike in Java where one may define custom annotations in addition to the standard ones. However, C++ does have implementation/vendor-specific attributes which are non-standard. These typically have a namespace associated with them. For instance, GCC and Clang have attributes under the <code>gnu::</code> namespace, and all such attributes are of the form {{cpp|[[gnu::*]]}}.
One may apply multiple attributes as a list, for instance {{cpp|[[A, B, C]]}} (where <code>A</code>, <code>B</code>, and <code>C</code> are attributes). Furthermore, attributes may also accept arguments, like {{cpp|[[A("This is a parameter")]]}}.