A standard attribute is a C-standard annotation written with double brackets, such as [[deprecated]] or [[nodiscard]]. It attaches a specified meaning to a language feature, allowing implementations to diagnose misuse or apply defined semantic assumptions. section 10.2.3
Deprecation annotation
[[deprecated("tell all about it")]] int old_interface(void); Using old_interface normally causes a compiler diagnostic. The diagnostic is not required when the use occurs inside another deprecated feature. [[nodiscard]] is another standard attribute that may receive a string argument. section 10.2.3
C23 supplies standard attributes including:
- [[deprecated]], [[fallthrough]], [[maybe_unused]], [[nodiscard]], [[noreturn]], [[unsequenced]], and [[reproducible]]. section 10.2.3
- Double-underscore variants such as [[__unsequenced__]] provide macro-safer spellings. section 10.2.3
