Syntax
|
|
attribute-list is a comma-separated list of attributes.
Common Attributes
packed
Removes default structure padding and minimizes alignment gaps.
|
|
Use with care: unaligned access can reduce performance or cause faults on some architectures.
aligned(n)
Forces object alignment to n bytes.
|
|
section("name")
Places variable/function into a custom linker section.
|
|
unused
Suppresses unused warnings.
|
|
weak
Declares weak symbol (can be overridden by strong definition).
|
|
noreturn
Marks function that never returns.
|
|
Notes
__attribute__is compiler-specific (GCC/Clang compatible in many cases).- Prefer macros for portability when targeting multiple compilers.