> What is an __attribute__? GCC Manual
It's a bit of magic which allows you to tell the compiler something about the code.
> What is this good for?
See the manual.
For example, the "packed" attribute is similar to the Microsoft "#pragma pack"
Attributes are both more extensive and more useful than pragmas though.
> What things similar to __attribute__ should I know in gcc?
See the manual.
You will notice that attributes are part of the "C Extensions" part of the manual. This means no other compiler supports them (or will support them in a different way).
How much of it is useful really depends on what you are doing. All of it is useful to somebody at some point, but you have to be doing something fairly unusual before any of the extensions become "a must".
By and large, you should be trying to write most of your code using only ANSI-C (which is portable).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.