A prefixed attribute names an implementation-specific feature with the form prefix::suffix. The prefix is typically associated with a compiler or tool implementor; the suffix identifies the feature. section 10.2.3
A format-checking attribute
[[__gnu__::__format__(__printf__, 3, 4)]] int snprintf(char *buf, size_t size, const char *frmt, ...); This tells GCC or Clang that the function processes a printf-style format at position 3 and begins its variable arguments at position 4, enabling warnings for invalid formats or argument types. section 10.2.3
Apply the feature with these constraints:
- Pass arguments when supported; syntactically, their parentheses, brackets, and braces must be correctly nested and balanced. section 10.2.3
- Guard implementation-specific syntax with __has_c_attribute when portability requires testing attribute support. section 10.2.3
