According to GCC's own documentation on variable attributes, the correct syntax for declaring an attribute unused is __attribute__((unused))
.
However, in many examples and other code online, I frequently see __attribute__((__unused__))
instead, and they appear to both work.
Is there a reason for either specifying or omitting the __
in either case? Does it make any difference, and is there a preferred version? Are there any situations where using one and not the other might cause problems?
Presumably the same applies to other attribute parameters as well?
At the top of the very page you linked, it tells you:
You may also specify attributes with ‘
__
’ preceding and following each keyword. This allows you to use them in header files without being concerned about a possible macro of the same name. For example, you may use__aligned__
instead ofaligned
.
Identifiers containing double underscores (__
) are reserved to the implementation. Hence no user program could legally define them as macros.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With